summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-14 01:16:33 +0000
committerPete Batard <pbatard@gmail.com>2010-01-14 01:16:33 +0000
commitbdcbace8814250a1995b329728931c0f8e5eb90c (patch)
tree0b759a298514fd08d902c55053f58940a80145dd /examples
parenteacdaf7c213adbe0ceee37d3b62019d607241a52 (diff)
downloadlibusb-bdcbace8814250a1995b329728931c0f8e5eb90c.tar.gz
svn r25:
- WinUSB composite device support (with DeviceClasses registry lookup) - better interface handling - other minor improvements
Diffstat (limited to 'examples')
-rw-r--r--examples/xusb.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/xusb.c b/examples/xusb.c
index 7e61c51..8614e2f 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -81,6 +81,7 @@ int test_device(uint16_t vid, uint16_t pid)
{
libusb_device_handle *handle;
int r;
+ int iface = 1;
printf("Opening device...\n");
handle = libusb_open_device_with_vid_pid(NULL, vid, pid);
@@ -90,23 +91,23 @@ int test_device(uint16_t vid, uint16_t pid)
return -1;
}
- printf("Claiming interface...\n");
- r = libusb_claim_interface(handle, 0);
+ printf("Claiming interface %d...\n", iface);
+ r = libusb_claim_interface(handle, iface);
if (r != LIBUSB_SUCCESS) {
// Maybe we need to detach the driver
perr("failed. Trying to detach driver...\n");
- CALL_CHECK(libusb_detach_kernel_driver(handle, 0));
+ CALL_CHECK(libusb_detach_kernel_driver(handle, iface));
printf("Claiming interface again...\n");
- CALL_CHECK(libusb_claim_interface(handle, 0));
+ CALL_CHECK(libusb_claim_interface(handle, iface));
}
char string[128];
printf("Retieving string descriptor...\n");
- CALL_CHECK(libusb_get_string_descriptor_ascii(handle, 2, string, 128));
+ CALL_CHECK(libusb_get_string_descriptor_ascii(handle, 3, string, 128));
printf("Got string: \"%s\"\n", string);
printf("Releasing interface...\n");
- CALL_CHECK(libusb_release_interface(handle, 0));
+ CALL_CHECK(libusb_release_interface(handle, iface));
printf("Closing device...\n");
libusb_close(handle);