summaryrefslogtreecommitdiffstats
path: root/daemon/usb-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/usb-linux.c')
-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)
322 usbdev->pid = devdesc.idProduct; 322 usbdev->pid = devdesc.idProduct;
323 usbdev->dev = handle; 323 usbdev->dev = handle;
324 usbdev->alive = 1; 324 usbdev->alive = 1;
325 usbdev->wMaxPacketSize = 0; 325 usbdev->wMaxPacketSize = libusb_get_max_packet_size(dev, BULK_OUT);
326 struct libusb_config_descriptor *cfg; 326 if (usbdev->wMaxPacketSize <= 0) {
327 if (libusb_get_active_config_descriptor(dev, &cfg) == 0
328 && cfg && cfg->bNumInterfaces >= (USB_INTERFACE+1)) {
329 const struct libusb_interface *ifp = &cfg->interface[USB_INTERFACE];
330 if (ifp && ifp->num_altsetting >= 1) {
331 const struct libusb_interface_descriptor *as = &ifp->altsetting[0];
332 int i;
333 for (i = 0; i < as->bNumEndpoints; i++) {
334 const struct libusb_endpoint_descriptor *ep = &as->endpoint[i];
335 if (ep->bEndpointAddress == BULK_OUT) {
336 usbdev->wMaxPacketSize = ep->wMaxPacketSize;
337 }
338 }
339 }
340 }
341 if (usbdev->wMaxPacketSize == 0) {
342 usbmuxd_log(LL_ERROR, "Could not determine wMaxPacketSize for device %d-%d, setting to 64", usbdev->bus, usbdev->address); 327 usbmuxd_log(LL_ERROR, "Could not determine wMaxPacketSize for device %d-%d, setting to 64", usbdev->bus, usbdev->address);
343 usbdev->wMaxPacketSize = 64; 328 usbdev->wMaxPacketSize = 64;
344 } else { 329 } else {