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

Leading zero missing in TrezorExample? #221

Open
moon6969 opened this issue Aug 27, 2021 · 1 comment
Open

Leading zero missing in TrezorExample? #221

moon6969 opened this issue Aug 27, 2021 · 1 comment

Comments

@moon6969
Copy link

The example code in https://github.com/MelbourneDeveloper/Device.Net#example-code has a leading zero added to the buffer...

//Create the request buffer
var buffer = new byte[65];
buffer[0] = 0x00;
buffer[1] = 0x3f;
buffer[2] = 0x23;
buffer[3] = 0x23;

but the source code sample does not...

//Create a buffer with 3 bytes (initialize)
var writeBuffer = new byte[64];
writeBuffer[0] = 0x3f;
writeBuffer[1] = 0x23;
writeBuffer[2] = 0x23;

For my usb hid device on Windows 10, I needed to add the leading zero to get it working.
I'm new to USB development, so found this quite confusing - WriteAndReadAsync() just blocks and never returns.

@moon6969
Copy link
Author

OK it's an extra byte for HID Report ID for HID transfers as discussed here...
https://melbournedeveloper.github.io/Device.Net/articles/HidTransfer.html

Might be worth a comment in TrezorExample.cs to nudge USB novices in the right direction?

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

No branches or pull requests

2 participants