diff options
author | Christian Starkjohann <cs+github@obdev.at> | 2008-07-14 10:47:24 +0000 |
---|---|---|
committer | Christian Starkjohann <cs+github@obdev.at> | 2008-07-14 10:47:24 +0000 |
commit | 3be7d0f6d85b8e4adb868f2076d7bf855f1da229 (patch) | |
tree | 9e232e31da497d1e7b54b85f88ff16fd7f5fe927 | |
parent | 733dc58a94ac06d124adcd6cbf11a3c97caf10da (diff) | |
download | v-usb-3be7d0f6d85b8e4adb868f2076d7bf855f1da229.tar.gz v-usb-3be7d0f6d85b8e4adb868f2076d7bf855f1da229.tar.bz2 v-usb-3be7d0f6d85b8e4adb868f2076d7bf855f1da229.zip |
- use control transfers to USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE
so that we need not claim the interface.
-rw-r--r-- | libs-host/hiddata.c | 4 | ||||
-rw-r--r-- | usbdrv/Changelog.txt | 3 |
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. |