summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-05-02 18:02:50 +0100
committerPete Batard <pete@akeo.ie>2012-05-02 18:02:50 +0100
commit939a4782b28c36dfddb68585c4b027a4d5494a5b (patch)
tree80b9197eb3d57248e5a754fe7bf27afa6df847ff
parentae1124c112c88e807fb5f500846c9b12ea882122 (diff)
downloadlibusb-939a4782b28c36dfddb68585c4b027a4d5494a5b.tar.gz
Samples: Remove interface requests when querying WCID devices
* As per MS documentation, querying of the Extended Properties is a device request (0xC0), not an interface one (0xC1), so there is no issue with the WinUSB wIndex override.
-rw-r--r--examples/xusb.c13
-rw-r--r--libusb/version.h2
2 files changed, 4 insertions, 11 deletions
diff --git a/examples/xusb.c b/examples/xusb.c
index 343a0b4..a98ebb4 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -535,12 +535,11 @@ static void read_ms_winsub_feature_descriptors(libusb_device_handle *handle, uin
void* le_type_punning_IS_fine;
struct {
const char* desc;
- uint8_t recipient;
uint16_t index;
uint16_t header_size;
} os_fd[2] = {
- {"Extended Compat ID", LIBUSB_RECIPIENT_DEVICE, 0x0004, 0x10},
- {"Extended Properties", LIBUSB_RECIPIENT_INTERFACE, 0x0005, 0x0A}
+ {"Extended Compat ID", 0x0004, 0x10},
+ {"Extended Properties", 0x0005, 0x0A}
};
if (iface_number < 0) return;
@@ -550,12 +549,6 @@ static void read_ms_winsub_feature_descriptors(libusb_device_handle *handle, uin
// Read the header part
r = libusb_control_transfer(handle, (uint8_t)(LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_VENDOR|LIBUSB_RECIPIENT_DEVICE),
- // NB: We should use os_fd[i].recipient instead of LIBUSB_RECIPIENT_DEVICE above, as
- // LIBUSB_RECIPIENT_INTERFACE should be used for the Extended Properties.
- // However, for Interface requests, the WinUSB DLL forces the low byte of wIndex
- // to the interface number, regardless of what you set it to, so we have to
- // fallback to Device and hope the firmware answers both equally.
- // See http://www.lvr.com/forum/index.php?topic=331
bRequest, (uint16_t)(((iface_number)<< 8)|0x00), os_fd[i].index, os_desc, os_fd[i].header_size, 1000);
if (r < os_fd[i].header_size) {
perr(" Failed: %s", (r<0)?libusb_error_name((enum libusb_error)r):"header size is too small");
@@ -568,7 +561,7 @@ static void read_ms_winsub_feature_descriptors(libusb_device_handle *handle, uin
}
// Read the full feature descriptor
- r = libusb_control_transfer(handle, (uint8_t)(LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_VENDOR|os_fd[i].recipient),
+ r = libusb_control_transfer(handle, (uint8_t)(LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_VENDOR|LIBUSB_RECIPIENT_DEVICE),
bRequest, (uint16_t)(((iface_number)<< 8)|0x00), os_fd[i].index, os_desc, (uint16_t)length, 1000);
if (r < 0) {
perr(" Failed: %s", libusb_error_name((enum libusb_error)r));
diff --git a/libusb/version.h b/libusb/version.h
index 5fd6719..ef81eba 100644
--- a/libusb/version.h
+++ b/libusb/version.h
@@ -9,7 +9,7 @@
#define LIBUSB_MICRO 10
#endif
#ifndef LIBUSB_NANO
-#define LIBUSB_NANO 10487
+#define LIBUSB_NANO 10488
#endif
/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
#ifndef LIBUSB_RC