From 2b52a9fca7e14ffe66fc0b4be22208240db2b76c Mon Sep 17 00:00:00 2001 From: Christian Starkjohann Date: Sun, 8 Jan 2012 19:27:26 +0000 Subject: - Fixed Unix version of usbhidSetReport(): If no report IDs were used, a wrong report ID was passed as message parameter. --- libs-host/hiddata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs-host') 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()); -- cgit v1.2.3