-
Notifications
You must be signed in to change notification settings - Fork 398
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
libusb: fix using LIBUSB_DT_REPORT for HID Report Descriptor #438
Comments
From HID USB specification:
It shall not return ... HID Report descriptor ... . Tried this with libusb: true - with my devices the interface descriptor contains the HID descriptor, but it doesn't include the HID Report descriptor. Looks like it is not an option( |
I wonder, what
means. What type of error do you get, if you try to gather the Report Descriptor? Do you know, how operating system drivers of Windows or hidraw request the Report Descriptor from these devices? I guess that usbutils (lsusb & usbhid-dump) fails for these devices too? |
Maybe my assumption about
That's what I intent to find out. Not the first time I'll be going thru hidraw sources. |
Interestingly,
Maybe I just need to poke around its sources. |
Both are based on libusb. I noticed, that usbhid-dump determines the size of the Report-Descriptor before reading it. |
Hm, that information is available from Interface descriptor. Maybe that's what is missing to make it wokr. |
Found this in kernel/hidusb driver. |
I saw this code of usbhid-dump: https://github.com/gregkh/usbutils/blame/master/usbhid-dump/src/iface_list.c#L94 |
Yeah, that's basically the same thing. |
I made an attempt to fix it here: https://github.com/libusb/hidapi/tree/libusb_report_descriptor_read I'll be able to check it some time later. |
libusb xusb may not handle atill the situations but it works to list the HID report descriptors (only for interface 0). Example run against teensy 2.0 RawHID device.
|
Ah, sorry I didn't explicitly mention it here regarding:
#444 completely resolves the issue now. |
BTW: in the xusb example here - there is a bug: |
Yes that example is only meant for the particular HID device in reality : |
Explicitly naming the parameter value as a variable would make a better sample. Just a thought. |
Sometime it is required to get/parse the HID Report Descriptor, e.g.:
Unfortunately not all devices haveLIBUSB_DT_REPORT
request implemented, even though raw USB descriptors contain the HID Report Descriptor.UPD: probably the way HIDAPI uses
LIBUSB_DT_REPORT
is not correct.Instead of using
LIBUSB_DT_REPORT
there are several possible alternatives:UPD: it only contains HID descriptor, and not the HID Report descriptor;
descriptors
from sysfs - linux-specific solution;UPD: same limitation as with libusb descriptors - HID Report descriptor is not part of the USB
descriptors
.The text was updated successfully, but these errors were encountered: