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.
Change-Id: I7eedfc5a127b0104e49dcc97bc939a5e8137c223
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
ssize_t r = count;
unsigned xfer;
int ret = 0;
+ size_t len;
DBG(cdev, "mtp_read(%zu)\n", count);
if (dev == NULL || dev->ep_out == NULL)
return -ENODEV;
- 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 */
requeue_req:
/* queue a request */
req = dev->rx_req[0];
- req->length = count;
+ req->length = len;
dev->rx_done = 0;
set_read_req_length(req);
ret = usb_ep_queue(dev->ep_out, req, GFP_KERNEL);