aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Starkjohann <cs+github@obdev.at>2012-01-08 19:27:26 +0000
committerChristian Starkjohann <cs+github@obdev.at>2012-01-08 19:27:26 +0000
commit2b52a9fca7e14ffe66fc0b4be22208240db2b76c (patch)
tree1dcc54b9020b5c176ec0a3906a19259fe3abbf71
parent7cc0da72195daa0ee891651e8726b6487387a5f7 (diff)
downloadv-usb-2b52a9fca7e14ffe66fc0b4be22208240db2b76c.tar.gz
v-usb-2b52a9fca7e14ffe66fc0b4be22208240db2b76c.tar.bz2
v-usb-2b52a9fca7e14ffe66fc0b4be22208240db2b76c.zip
- Fixed Unix version of usbhidSetReport(): If no report IDs were used, a wrong report ID was passed as message parameter.
-rw-r--r--libs-host/hiddata.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs-host/hiddata.c b/libs-host/hiddata.c
index 0f1915a..e4645b8 100644
--- a/libs-host/hiddata.c
+++ b/libs-host/hiddata.c
@@ -281,13 +281,13 @@ void usbhidCloseDevice(usbDevice_t *device)
int usbhidSetReport(usbDevice_t *device, char *buffer, int len)
{
-int bytesSent;
+int bytesSent, reportId = buffer[0];
if(!usesReportIDs){
buffer++; /* skip dummy report ID */
len--;
}
- 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);
+ 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 | (reportId & 0xff), 0, buffer, len, 5000);
if(bytesSent != len){
if(bytesSent < 0)
fprintf(stderr, "Error sending message: %s\n", usb_strerror());