summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-08-28 13:53:08 +0200
committerGravatar Nikias Bassen2009-08-28 13:53:08 +0200
commit856ddf1fe694686d98dc4b847a4e0f9ec6a8f418 (patch)
tree0aeb68bacc638010644eb12c9cb625b02ef5b9de
parent3f84355300b83eb737e77a5c0e06bc0740758085 (diff)
downloadusbmuxd-856ddf1fe694686d98dc4b847a4e0f9ec6a8f418.tar.gz
usbmuxd-856ddf1fe694686d98dc4b847a4e0f9ec6a8f418.tar.bz2
usb-linux: use libusb_get_max_packet_size() instead of custom code.
-rw-r--r--daemon/usb-linux.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/daemon/usb-linux.c b/daemon/usb-linux.c
index c09cdc9..6f25ed4 100644
--- a/daemon/usb-linux.c
+++ b/daemon/usb-linux.c
@@ -322,23 +322,8 @@ static int usb_discover(void)
usbdev->pid = devdesc.idProduct;
usbdev->dev = handle;
usbdev->alive = 1;
- usbdev->wMaxPacketSize = 0;
- struct libusb_config_descriptor *cfg;
- if (libusb_get_active_config_descriptor(dev, &cfg) == 0
- && cfg && cfg->bNumInterfaces >= (USB_INTERFACE+1)) {
- const struct libusb_interface *ifp = &cfg->interface[USB_INTERFACE];
- if (ifp && ifp->num_altsetting >= 1) {
- const struct libusb_interface_descriptor *as = &ifp->altsetting[0];
- int i;
- for (i = 0; i < as->bNumEndpoints; i++) {
- const struct libusb_endpoint_descriptor *ep = &as->endpoint[i];
- if (ep->bEndpointAddress == BULK_OUT) {
- usbdev->wMaxPacketSize = ep->wMaxPacketSize;
- }
- }
- }
- }
- if (usbdev->wMaxPacketSize == 0) {
+ usbdev->wMaxPacketSize = libusb_get_max_packet_size(dev, BULK_OUT);
+ if (usbdev->wMaxPacketSize <= 0) {
usbmuxd_log(LL_ERROR, "Could not determine wMaxPacketSize for device %d-%d, setting to 64", usbdev->bus, usbdev->address);
usbdev->wMaxPacketSize = 64;
} else {