I'm referring to one USB HID device, which has two independent HID interfaces (each with a report descriptor, one is Heavyweight report descriptor,another is Lightweight report descriptor).
for libusb
read light descriptor(one report descriptor):
int len = usb_control_msg(hidif->dev_handle,
USB_ENDPOINT_IN+1,
USB_REQ_GET_DESCRIPTOR,
(USB_DT_REPORT << 8), hidif->interfa, // Report desc, index=0
(char*)hidif->ReportDesc, hidif->ReportDescSize,
USB_TIMEOUT);
read weight descriptor(two report descriptor):
int len = usb_control_msg(hidif->dev_handle,
USB_ENDPOINT_IN+1,
USB_REQ_GET_DESCRIPTOR,
(USB_DT_REPORT << 8) + 1, hidif->interfa, // Report desc, index=1
(char*)hidif->ReportDesc, hidif->ReportDescSize,
USB_TIMEOUT);
I print the length of report descriptor is 2555 using libusb to get heavyweight report descriptor.
but for hidAPI, the method "hid_get_report_descriptor(hidif->handle, hidif->ReportDesc, sizeof(descriptor)) " obtain report descriptor for index 0, it seems get the Lightweight report descriptor, because the length is 1826
I'm referring to one USB HID device, which has two independent HID interfaces (each with a report descriptor, one is Heavyweight report descriptor,another is Lightweight report descriptor).
for libusb
read light descriptor(one report descriptor):
int len = usb_control_msg(hidif->dev_handle,
USB_ENDPOINT_IN+1,
USB_REQ_GET_DESCRIPTOR,
(USB_DT_REPORT << 8), hidif->interfa, // Report desc, index=0
(char*)hidif->ReportDesc, hidif->ReportDescSize,
USB_TIMEOUT);
read weight descriptor(two report descriptor):
int len = usb_control_msg(hidif->dev_handle,
USB_ENDPOINT_IN+1,
USB_REQ_GET_DESCRIPTOR,
(USB_DT_REPORT << 8) + 1, hidif->interfa, // Report desc, index=1
(char*)hidif->ReportDesc, hidif->ReportDescSize,
USB_TIMEOUT);
I print the length of report descriptor is 2555 using libusb to get heavyweight report descriptor.
but for hidAPI, the method "hid_get_report_descriptor(hidif->handle, hidif->ReportDesc, sizeof(descriptor)) " obtain report descriptor for index 0, it seems get the Lightweight report descriptor, because the length is 1826