From 3be61d3850169105bf0cfc8cd2f0ee22697496bb Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Tue, 6 Feb 2018 18:25:44 -0800 Subject: [PATCH] Remove urb request size maximum. The 16kB maximum for transfers was removed from the kernel in 3.3. Devio has since supported arbitrary transfer sizes through scatter gather. See the following kernel patches for context: "USB: change the memory limits in usbfs URB submission" "usbdevfs: Use scatter-gather lists for large bulk transfers" Bug: 67683483 Test: Run usb_async_test app with USB3 : 38MB/s -> 300MB/s Change-Id: Ia52440cb725561b0f1db1a75aa1b8ab952585826 --- libusbhost/usbhost.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/libusbhost/usbhost.c b/libusbhost/usbhost.c index fa0191bf8..cb8d430db 100644 --- a/libusbhost/usbhost.c +++ b/libusbhost/usbhost.c @@ -64,10 +64,6 @@ // Some devices fail to send string descriptors if we attempt reading > 255 bytes #define MAX_STRING_DESCRIPTOR_LENGTH 255 -// From drivers/usb/core/devio.c -// I don't know why this isn't in a kernel header -#define MAX_USBFS_BUFFER_SIZE 16384 - #define MAX_USBFS_WD_COUNT 10 struct usb_host_context { @@ -664,10 +660,6 @@ int usb_device_bulk_transfer(struct usb_device *device, { struct usbdevfs_bulktransfer ctrl; - // need to limit request size to avoid EINVAL - if (length > MAX_USBFS_BUFFER_SIZE) - length = MAX_USBFS_BUFFER_SIZE; - memset(&ctrl, 0, sizeof(ctrl)); ctrl.ep = endpoint; ctrl.len = length; @@ -727,11 +719,7 @@ int usb_request_queue(struct usb_request *req) urb->status = -1; urb->buffer = req->buffer; - // need to limit request size to avoid EINVAL - if (req->buffer_length > MAX_USBFS_BUFFER_SIZE) - urb->buffer_length = MAX_USBFS_BUFFER_SIZE; - else - urb->buffer_length = req->buffer_length; + urb->buffer_length = req->buffer_length; do { res = ioctl(req->dev->fd, USBDEVFS_SUBMITURB, urb);