ANDROID: usb: gadget: fix MTP enumeration issue under super speed mode

MTP function doesn't show as a drive in Windows when the device
is connected to PC's USB3 port, because device fails to respond
ACK to BULK OUT transfer request.

This patch modifies MTP OUT request length as multiple of MaxPacketSize
per databook requirement in order to fix this issue.

Patchset: mtp

Change-Id: I090d7880ff00c499dc5ba7fd644b1fe7cd87fcb5
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
Signed-off-by: Wang, Yu <yu.y.wang@intel.com>
Signed-off-by: Russ Weight <russell.h.weight@intel.com>
This commit is contained in:
Jiebing Li 2015-03-10 11:24:00 +08:00 committed by Badhri Jagan Sridharan
parent d04f4c7320
commit 0ed8679d0d

View file

@ -540,10 +540,12 @@ static ssize_t mtp_read(struct file *fp, char __user *buf,
ssize_t r = count;
unsigned xfer;
int ret = 0;
size_t len;
DBG(cdev, "mtp_read(%zu)\n", count);
if (count > MTP_BULK_BUFFER_SIZE)
len = usb_ep_align_maybe(cdev->gadget, dev->ep_out, count);
if (len > MTP_BULK_BUFFER_SIZE)
return -EINVAL;
/* we will block until we're online */
@ -567,7 +569,7 @@ static ssize_t mtp_read(struct file *fp, char __user *buf,
requeue_req:
/* queue a request */
req = dev->rx_req[0];
req->length = count;
req->length = len;
dev->rx_done = 0;
ret = usb_ep_queue(dev->ep_out, req, GFP_KERNEL);
if (ret < 0) {