summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/xusb.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/xusb.c b/examples/xusb.c
index 15dc126..6ebaa17 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -497,6 +497,17 @@ int test_hid(libusb_device_handle *handle, uint8_t endpoint_in)
return -1;
}
+ printf("\nReading Feature Report...\n");
+ r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
+ HID_GET_REPORT, (HID_REPORT_TYPE_FEATURE<<8)|0, 0, input_report, (uint16_t)size, 5000);
+ if (r >= 0) {
+ display_buffer_hex(input_report, size);
+ } else if (r == LIBUSB_ERROR_NOT_FOUND) {
+ printf(" No Feature Report available for this device\n");
+ } else {
+ printf(" Error: %s\n", libusb_strerror(r));
+ }
+
printf("\nReading Input Report...\n");
r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
HID_GET_REPORT, (HID_REPORT_TYPE_INPUT<<8)|0x00, 0, input_report, (uint16_t)size, 5000);
@@ -508,7 +519,7 @@ int test_hid(libusb_device_handle *handle, uint8_t endpoint_in)
printf(" Timeout! Please make sure you act on the device within the 5 seconds allocated...\n");
break;
default:
- printf(" Error: %d\n", r);
+ printf(" Error: %s\n", libusb_strerror(r));
break;
}
}
@@ -614,10 +625,10 @@ int test_device(uint16_t vid, uint16_t pid)
}
#endif
+ printf("\nReading string descriptors:\n");
r = libusb_get_string_descriptor(handle, 0, 0, string, 128);
if (r > 0) {
nb_strings = string[0];
- printf("\nReading string descriptors:\n");
for (i=1; i<nb_strings; i++) {
if (libusb_get_string_descriptor_ascii(handle, (uint8_t)i, string, 128) >= 0) {
printf(" String (%d/%d): \"%s\"\n", i, nb_strings-1, string);