diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2011-07-06 22:33:10 +0100 |
---|---|---|
committer | Alan Stern <stern@rowland.harvard.edu> | 2011-07-06 22:33:10 +0100 |
commit | b5c9800bbd4e3a5f31f6f314bcee2c178f8f0b47 (patch) | |
tree | 81b14afc9491466632ffae4a994144d123369359 | |
parent | 0ffb89ce6a3604731ddc265533b22ef42aecea63 (diff) | |
download | libusb-b5c9800bbd4e3a5f31f6f314bcee2c178f8f0b47.tar.gz |
[xusb] use bulk endpoints only for testing
* also reverts to using first endpoint found rather than last
-rw-r--r-- | examples/xusb.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/xusb.c b/examples/xusb.c index cfa63f7..a499d2e 100644 --- a/examples/xusb.c +++ b/examples/xusb.c @@ -599,11 +599,15 @@ int test_device(uint16_t vid, uint16_t pid) for (k=0; k<conf_desc->usb_interface[i].altsetting[j].bNumEndpoints; k++) { endpoint = &conf_desc->usb_interface[i].altsetting[j].endpoint[k]; printf(" endpoint[%d].address: %02X\n", k, endpoint->bEndpointAddress); - // Use the last IN/OUT endpoints found as default for testing - if (endpoint->bEndpointAddress & LIBUSB_ENDPOINT_IN) { - endpoint_in = endpoint->bEndpointAddress; - } else { - endpoint_out = endpoint->bEndpointAddress; + // Use the first bulk IN/OUT endpoints found as default for testing + if ((endpoint->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) == LIBUSB_TRANSFER_TYPE_BULK) { + if (endpoint->bEndpointAddress & LIBUSB_ENDPOINT_IN) { + if (!endpoint_in) + endpoint_in = endpoint->bEndpointAddress; + } else { + if (!endpoint_out) + endpoint_out = endpoint->bEndpointAddress; + } } printf(" max packet size: %04X\n", endpoint->wMaxPacketSize); printf(" polling interval: %02X\n", endpoint->bInterval); |