Skip to content

Fix Windows HID backend missing byte - #986

Closed
mcuee wants to merge 1 commit into
libusb:masterfrom
mcuee:mcuee-patch-1
Closed

mcuee wants to merge 1 commit into
libusb:masterfrom
mcuee:mcuee-patch-1

Conversation

@mcuee

@mcuee mcuee commented Aug 27, 2021

Copy link
Copy Markdown
Member

#902 (comment)
Jonas' comment is correct, when the report id is zero, we should indeed skip the first byte of transfer_priv->hid_buffer, since it is not part of the actual report. But the report size should not change.

@mcuee

mcuee commented Aug 27, 2021 •

Copy link
Copy Markdown
Member Author

Test 1: with no report id (report id treat as 0).
https://github.com/mcuee/picusb/tree/master/lvr_genhid

FW is from http://janaxelson.com/hidpage.htm and proven to work using her original Windows C# code.

Without the fix

C:\work\picusb\picusb\lvr_genhid [master ≡ +6 ~2 -0 !]> .\libusb_lvrhid4.exe
Successfully find the LVR Generic HID device
Successfully set usb configuration 1
Successfully claimed interface
Testing control transfer using loop back test of feature report
20, 20; 21, fffffff7;
Testing interrupt transfer using loop back test of input/output report
40, 40; 41, 41;

With the fix

C:\work\picusb\picusb\lvr_genhid [master ≡ +8 ~2 -0 !]> .\libusb_lvrhid4.exe
Successfully find the LVR Generic HID device
Successfully set usb configuration 1
Successfully claimed interface
Testing control transfer using loop back test of feature report
20, 20; 21, 21;
Testing interrupt transfer using loop back test of input/output report
40, 40; 41, 41;

@mcuee

mcuee commented Aug 27, 2021

Copy link
Copy Markdown
Member Author

Test 2: with report id
https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod

No regression found. The output is the same with or without the fix.

C:\work\picusb\picusb\lvr_genhid_mod [master ≡ +15 ~2 -0 !]> .\libusb1_lvrhid8.exe
Successfully find the LVR Generic HID device
Successfully set usb configuration 1
Successfully claimed MYINTERFACE
Testing control transfer using loop back test of feature report
03, 04; 21, 21; 22, 22; 23, 00;
Testing control transfer using loop back test of input/output report
02, 01; 31, 31; 32, 32; 33, 00;
Testing interrupt transfer using loop back test of input/output report
02, 01; 41, 41; 42, 42; 43, 00;

@tormodvolden

Copy link
Copy Markdown
Contributor

Style suggestion: You could maybe include more of Jonas' explanation in the commit message, so that the git log can be read and understood without having to look up a github tracker. Or if there is already enough explained, just thank <full name> for the investigation and put the link less prominently below.

@mcuee

mcuee commented Aug 30, 2021 •

Copy link
Copy Markdown
Member Author

I think the explanation is enough for the code change in this case. The others are not really relevant in this case.

When the report id is zero, we should indeed skip the first byte of transfer_priv->hid_buffer, since it is not part of the actual report. But the report size should not change.

Thanks to Jonas Malaco who has done the investigation in this issue.
Reference: Jonas Malaco's comments
#902 (comment)
@mcuee

mcuee commented Aug 30, 2021

Copy link
Copy Markdown
Member Author

@tormodvolden Please check the updated commit message to see if that is okay.

@tormodvolden

Copy link
Copy Markdown
Contributor

Perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants