aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libs-host/hiddata.c4
-rw-r--r--usbdrv/Changelog.txt3
2 files changed, 5 insertions, 2 deletions
diff --git a/libs-host/hiddata.c b/libs-host/hiddata.c
index 5424405..54b8dbb 100644
--- a/libs-host/hiddata.c
+++ b/libs-host/hiddata.c
@@ -280,7 +280,7 @@ int bytesSent;
buffer++; /* skip dummy report ID */
len--;
}
- bytesSent = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | (buffer[0] & 0xff), 0, buffer, len, 5000);
+ bytesSent = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | (buffer[0] & 0xff), 0, buffer, len, 5000);
if(bytesSent != len){
if(bytesSent < 0)
fprintf(stderr, "Error sending message: %s\n", usb_strerror());
@@ -299,7 +299,7 @@ int bytesReceived, maxLen = *len;
buffer++; /* make room for dummy report ID */
maxLen--;
}
- bytesReceived = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | reportNumber, 0, buffer, maxLen, 5000);
+ bytesReceived = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_DEVICE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | reportNumber, 0, buffer, maxLen, 5000);
if(bytesReceived < 0){
fprintf(stderr, "Error sending message: %s\n", usb_strerror());
return USBOPEN_ERR_IO;
diff --git a/usbdrv/Changelog.txt b/usbdrv/Changelog.txt
index 6040739..8b657bb 100644
--- a/usbdrv/Changelog.txt
+++ b/usbdrv/Changelog.txt
@@ -241,3 +241,6 @@ Scroll down to the bottom to see the most recent changes.
environments.
- Long transfers (above 254 bytes) did not work when usbFunctionRead() was
used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!]
+ - In hiddata.c (example code for sending/receiving data over HID), use
+ USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so
+ that we need not claim the interface.