summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/f_mtp.c
AgeCommit message (Collapse)Author
2011-07-20USB: gadget: f_mtp: Move all setup handling to mtp_ctrlrequestMike Lockwood
The composite driver no longer sends setup requests to functions if the destination is USB_RECIP_DEVICE, so we need to handle the requests here instead of the function's setup callback. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-15USB: gadget: f_mtp: Add support for sending MTP header during file transferMike Lockwood
MTP_SEND_FILE_WITH_HEADER ioctl allows sending a file with the 12 byte header prepended at the beginning. This is to allow MTP to use a single packet for the data phase instead of two. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17USB: gadget: f_mtp: Add PTP variant of MTP USB functionMike Lockwood
This is the same as MTP but with PTP interface descriptor. Also removed obsolete ioctl for switching between MTP and PTP mode Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17USB: gadget: f_mtp: Add support for queueing multiple interrupt requestsMike Lockwood
Fixes problem sending "store added" events when there are multiple stores Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17usb: gadget: android: Update android gadget driverBenoit Goby
* Functions and the device descriptor are configured from user space: echo 0 > /sys/class/android_usb/android0/enable echo adb,acm > /sys/class/android_usb/android0/functions echo 2 > /sys/class/android_usb/android0/f_acm/instances echo 1 > /sys/class/android_usb/android0/enable * Driver does not require platform data anymore * Moved function initialization to android.c instead of each function file * Replaced switches by uevents Signed-off-by: Benoit Goby <benoit@android.com> Signed-off-by: Mike Lockwood <lockwood@android.com> Change-Id: If5ad9267c111ad0a442f0d87a0d31082dc5381b6
2011-06-14USB: gadget: f_mtp: dequeue request on error in mtp_readMike Lockwood
In mtp_read(), if wait_event_interruptible() returns an error, we need to remove the request from the EP queue. Else, on the next call to mtp_read(), we will attempt to enqueue the request again, potentially corrupting the queue. This is what happens with musb_gadget_queue(), which does not check for duplicate requests. Based on a similar change to f_adb.c Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Don't block in mtp_send_eventMike Lockwood
We used to wait for the previous interrupt packet to complete before sending the next packet. But unfortunately the previous packet will not complete until USB is disconnected if the host is not listening on the interrupt endpoint (which is the case with libmtp on Linux and Mac). To avoid hanging indefinitely in this case, we now simply return -EBUSY if the previous interrupt packet has not completed yet. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Fix problems transferring files from device to hostMike Lockwood
Exit from send_file_work immediately when a cancel request is received. Only busy status if there is a cancel pending that has not been repoorted to userspace. This avoids a race condition that can occur when mtp_read resets the state to STATE_BUSY before we report status OK back to the host. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Make sure request is dequeued if transfer is canceledMike Lockwood
If the host cancels a file transfer while we have a read request pending, call usb_ep_dequeue to cancel the read. Also return -ECANCELED from mtp_ioctl if we are canceled in MTP_RECEIVE_FILE Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Zero length packet fixesMike Lockwood
Send zero length packets at end of transfers that are a multiple of the bulk max packet size as required by MTP. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Support for file transfer length greater than 4 gigabytesMike Lockwood
For backward compatibility with PTP, MTP is limited to a 32-bit file size. When transferring files greater than 4 gig, MTP uses 0xFFFFFFFF as the file size and the receiver reads until it receives a short packet. Expanded size of mtp_file_range.length to 64 bits and added support for writing zero length packets. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Return zero result for successful file transfer.Mike Lockwood
Returning number of bytes transfered does not work for files > 2 gig since ioctl() result is a signed integer. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: MTP driver cleanup:Mike Lockwood
Use a work queue instead of a separate thread for file transfer ioctls (note: the file transfer must be done on a kernel thread rather than in process context so vfs_read and vfs_write will use the correct address space for the buffers) Enforce requirement that only one ioctl call may be active at a time, and remove mutex in mtp_send_event that is now no longer necessary. Synchronize around use of shared variables to avoid SMP issues Fix mismatched calls to fget and fput Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Add ioctl for sending events via the interrupt endpointMike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: USB gadget function driver for MTP and PTP device support.Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>