Device.Net icon indicating copy to clipboard operation
Device.Net copied to clipboard

Leading zero missing in TrezorExample?

Open moon6969 opened this issue 3 years ago • 1 comments

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... https://github.com/MelbourneDeveloper/Device.Net/blob/417330ef418a7bacce36dae29eb6f67fc7620723/src/Usb.Net.UWP.Sample/TrezorExample.cs#L85-L89

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 avatar Aug 27 '21 17:08 moon6969

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?

moon6969 avatar Aug 29 '21 10:08 moon6969