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

windows: Base HID device descriptor on cached values #1378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tormodvolden
Copy link
Contributor

Instead of filling in the blanks with hard-coded made-up values that are sometimes correct, use the cached descriptor values retrieved during enumeration, which should provide more correct values.

References #1360

Instead of filling in the blanks with hard-coded made-up values that are
sometimes correct, use the cached descriptor values retrieved during
enumeration, which should be a better fallback.

References libusb#1360

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
@tormodvolden tormodvolden added windows HID HID related labels Dec 13, 2023
Copy link
Member

@Youw Youw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonable

@mcuee
Copy link
Member

mcuee commented Dec 18, 2023

looks reasonable

I agree. This PR should be good to go.

@tormodvolden
Copy link
Contributor Author

For little bit of background here, the code with these hard-coded values haven't been touched since the HID backend was (re?)introduced in 2012. It is pretty much the same in the oldest libusb-win32 git entry I could find from 2007. Back then it was maybe not practical to get the "true" device descriptor from the hub drivers, I don't know exactly. But no one has complained all this time, so we are not in a rush to change it, and definitely not now while we are in release freeze for 1.0.27. We cannot know what downstream code is dependent on the "made-up" values.

It is also interesting that some HID devices seem to display e.g. a non-standard bcdUSB value. I don't know if it is the device itself or a Windows driver that comes up with these values.

tormodvolden added a commit that referenced this pull request Dec 19, 2023
Some device descriptor fields are hard-coded by the HID backend, so they
will often not match. It is complicated to narrow this down to HID
devices, so we simply ignore these fields on Windows wholesale.

Hopefully we will fix the HID backend later, and this workaround can
then be reverted.

References #1360
References #1378

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
@mcuee
Copy link
Member

mcuee commented Dec 19, 2023

We recommend users to use HIDAPI anyway for USB HID devices. So indeed no rush to change the codes before 1.0.27 release.

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

Successfully merging this pull request may close these issues.

None yet

4 participants