2005-10-01 23:32:23

by Christopher Li

[permalink] [raw]
Subject: [PATCH] increase the usbdevfs control transfer buffer size

Increase the size setup data size.

This happen with a few devices that need to send control transfer
with data exactly 4K. But the devio fail those URB, as it count
setup data as part of the 4K size limit as well.

This patch increase the size limit by 8 byte to allow those setup
transfer to pass through.

In theory the size limit of the setup transfer is 64K data.
But I did not see any device need to use more than 4K of data so far.

Tested with EX200 USB explore used in a VM, (which is one of the device
hit this limit.)


Signed-Off-By: Christopher Li <[email protected]>
Index: linux-2.6.13.2/drivers/usb/core/devio.c
===================================================================
--- linux-2.6.13.2.orig/drivers/usb/core/devio.c 2005-09-16 18:02:12.000000000 -0700
+++ linux-2.6.13.2/drivers/usb/core/devio.c 2005-09-28 12:56:37.000000000 -0700
@@ -854,7 +854,7 @@ static int proc_do_submiturb(struct dev_
!= USB_ENDPOINT_XFER_CONTROL)
return -EINVAL;
/* min 8 byte setup packet, max arbitrary */
- if (uurb->buffer_length < 8 || uurb->buffer_length > PAGE_SIZE)
+ if (uurb->buffer_length < 8 || uurb->buffer_length > PAGE_SIZE + 8)
return -EINVAL;
if (!(dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL)))
return -ENOMEM;