Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Remove urb request size maximum."
Browse files Browse the repository at this point in the history
am: 1cb765c

Change-Id: I2915011f47e312888d5e330be62cf76576d9cf3a
  • Loading branch information
Jerry Zhang authored and android-build-merger committed Feb 13, 2018
2 parents b84d662 + 1cb765c commit 1ab6e9d
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions libusbhost/usbhost.c
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1ab6e9d

Please sign in to comment.