libusb: fix HID Report descriptor request #444

Merged
Youw merged 2 commits from libusb_report_descriptor_read into master 2022-08-16 08:29:11 -05:00
Youw commented 2022-08-15 05:13:52 -05:00 (Migrated from github.com)
  • pass the actual HID Report descriptor size (from HID descriptor);
  • interface_num has to be wIndex, and not as part of wValue for LIBUSB_DT_REPORT request;

TODO:

  • Iterate over all Interface descriptors, to find the HID Descriptor (currently assuming the first one);

Resolves: #438

- pass the actual HID Report descriptor size (from HID descriptor); - interface_num has to be wIndex, and not as part of wValue for LIBUSB_DT_REPORT request; TODO: - [x] Iterate over all Interface descriptors, to find the HID Descriptor (currently assuming the first one); Resolves: #438
JoergAtGithub (Migrated from github.com) reviewed 2022-08-15 12:38:51 -05:00
@ -575,1 +579,4 @@
See USB HID Specificatin, sectin 7.1.1
*/
int res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8), interface_num, data, report_descriptor_size, 5000);
if (res >= 0) {
JoergAtGithub (Migrated from github.com) commented 2022-08-15 12:38:51 -05:00

I recommend to use github.com/libusb/hidapi@65b9e712b1/hidapi/hidapi.h (L97) from the Get_Descriptor branch instead of repeating this value multiple times

I recommend to use https://github.com/libusb/hidapi/blob/65b9e712b1006366f646fad3b9d5d8e9de2dcfae/hidapi/hidapi.h#L97 from the Get_Descriptor branch instead of repeating this value multiple times
Youw (Migrated from github.com) reviewed 2022-08-15 12:42:30 -05:00
@ -575,1 +579,4 @@
See USB HID Specificatin, sectin 7.1.1
*/
int res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8), interface_num, data, report_descriptor_size, 5000);
if (res >= 0) {
Youw (Migrated from github.com) commented 2022-08-15 12:42:30 -05:00

from the Get_Descriptor branch

My current intention is to update this code for get_descriptor branch, once this PR is in master.
This branch is going to be merged to master sooner than get_descriptor.

> from the Get_Descriptor branch My current intention is to update this code for `get_descriptor` branch, once this PR is in master. This branch is going to be merged to master sooner than `get_descriptor`.
mcuee (Migrated from github.com) approved these changes 2022-08-16 08:27:07 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!444
No description provided.