Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB2 Stick Driver #21

Merged
merged 4 commits into from Jan 1, 2012
Merged

USB2 Stick Driver #21

merged 4 commits into from Jan 1, 2012

Conversation

DanAnkers
Copy link
Contributor

This is a basic version of a driver for the USB2 stick. Applying this should close #11

Unfortunately I've not got a USB1 stick so I can't verify correct behaviour, bur querying capabilities gives a sensible looking answer.

Dan

@DanAnkers
Copy link
Contributor Author

Here is the capabilities report. Can someone check whether it looks similar to the output from a USB1 stick:
$ python demos/ant.core/02-capabilities-USB.py

========== [WRITE] ==========
0000 A4 01 4A 00 EF

========== [WRITE] ==========
0000 A4 02 4D 00 54 BF

========== [READ] ==========
0000 A4 06 54 08 03 00 BA 36
0000 00 71

========== [WRITE] ==========
0000 A4 09 46 00 00 00 00 00
0000 00 00 00 00 EB

========== [READ] ==========
0000 A4 03 40 00 46 00 A1

========== [WRITE] ==========
0000 A4 09 46 01 00 00 00 00
0000 00 00 00 00 EA

========== [READ] ==========
0000 A4 03 40 01 46 00 A0

========== [WRITE] ==========
0000 A4 09 46 02 00 00 00 00
0000 00 00 00 00 E9

========== [READ] ==========
0000 A4 03 40 02 46 00 A3

Maximum channels: 8
Maximum network keys: 3
Standard options: 0
Advanced options: BA
========== [WRITE] ==========
0000 A4 01 4A 00 EF

========== [READ] ==========
0000 A4 01 6F 20 EA

@mvillalba
Copy link
Owner

Superficially, it looks fine. I'll take a deeper look and merge it later.

Thanks for this, by the way. I've been swamped lately.

mvillalba added a commit that referenced this pull request Jan 1, 2012
@mvillalba mvillalba merged commit 40b559e into mvillalba:develop Jan 1, 2012
@marwooj
Copy link

marwooj commented Oct 21, 2012

What if mine stops just after 4 msg?
python 02-capabilities-USB.py

========== [WRITE] ==========
0000 A4 01 4A 00 EF

========== [READ] ==========
0000 A4 01 6F 00 CA

========== [WRITE] ==========
0000 A4 02 4D 00 54 BF

========== [READ] ==========
0000 A4 06 54 08 03 00 BA 36
0000 00 71

and then nothing....

@aarongurley
Copy link

I've got the same result. 4 messages and then nothing. Any ideas?

========== [WRITE] ==========
0000 A4 01 4A 00 EF

========== [WRITE] ==========
0000 A4 02 4D 00 54 BF

========== [READ] ==========
0000 A4 01 6F 00 CA

========== [READ] ==========
0000 A4 06 54 08 03 00 BA 36
0000 00 71

@aarongurley
Copy link

Got an something working. I setup an example where I wrote just the raw hex bytes noted above by @DanAnkers.

On a Garmin USB 2 stick, if I write the first two bytes (0000) from ever write line then it fails, but if I remove them then it works successfully.

However, on a Garmin USB 1 stick, I must include those bytes (0000) on every write line for it to work correctly.

@mrozaini
Copy link

mrozaini commented Oct 5, 2013

i face the same problem. aarongurley, may i know which file did you make a change? thanks

@aarongurley
Copy link

I never fixed the code to correct the problem, but I think it's deeper than one single location. You might try to make the fix in the USB2Driver class. If memory serves me right, you just need to remove the first two bytes from any message being written to that driver.

I ended up going a slightly different route. I'm not really a python programmer, so I set out to write something that was a bit more native to me. I started working on a Node.js version of this library. It's very early but proving easy to work with. You can find it here: node-ant. Hope this helps!

@mrozaini
Copy link

mrozaini commented Nov 4, 2013

i get this after i comment #self.driver.write(msg.encode()) in node.py under reset function. Below is the result i get it after i remove that line
Using log file: 2013-11-04T12:24:58.894734.ant

========== [WRITE] ==========
0000 A4 02 4D 00 54 BF

========== [READ] ==========
0000 A4 08 54 08 08 00 BA 36
0000 00 DF FB 50

========== [WRITE] ==========
0000 A4 09 46 00 00 00 00 00
0000 00 00 00 00 EB

========== [READ] ==========
0000 A4 03 40 00 46 00 A1

========== [WRITE] ==========
0000 A4 09 46 01 00 00 00 00
0000 00 00 00 00 EA

========== [READ] ==========
0000 A4 03 40 01 46 00 A0

========== [WRITE] ==========
0000 A4 09 46 02 00 00 00 00
0000 00 00 00 00 E9

========== [READ] ==========
0000 A4 03 40 02 46 00 A3

========== [WRITE] ==========
0000 A4 09 46 03 00 00 00 00
0000 00 00 00 00 E8

========== [READ] ==========
0000 A4 03 40 03 46 00 A2

========== [WRITE] ==========
0000 A4 09 46 04 00 00 00 00
0000 00 00 00 00 EF

========== [READ] ==========
0000 A4 03 40 04 46 00 A5

========== [WRITE] ==========
0000 A4 09 46 05 00 00 00 00
0000 00 00 00 00 EE

========== [READ] ==========
0000 A4 03 40 05 46 00 A4

========== [WRITE] ==========
0000 A4 09 46 06 00 00 00 00
0000 00 00 00 00 ED

========== [READ] ==========
0000 A4 03 40 06 46 00 A7

========== [WRITE] ==========
0000 A4 09 46 07 00 00 00 00
0000 00 00 00 00 EC

========== [READ] ==========
0000 A4 03 40 07 46 00 A6

Maximum channels: 8
Maximum network keys: 8
Standard options: 0
Advanced options: BA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

USB2 stick driver
5 participants