aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-12-02 13:58:28 +0800
committerJohn Stultz <john.stultz@linaro.org>2012-02-14 14:27:21 -0800
commit50a06d0cff576c7cdf99f5fcbc8fa659b0773a3c (patch)
treebea5ace0a36fb20bf2abdcef1d4365ccfd35d787 /include
parentdc5181a7ffacc4c109dbd2b0e39e1b81c314cfeb (diff)
USB: gadget: f_mtp: Add support for sending MTP header during file transfer
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/f_mtp.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h
index fdf828c4925..7422b17c6eb 100644
--- a/include/linux/usb/f_mtp.h
+++ b/include/linux/usb/f_mtp.h
@@ -18,6 +18,22 @@
#ifndef __LINUX_USB_F_MTP_H
#define __LINUX_USB_F_MTP_H
+#include <linux/ioctl.h>
+
+#ifdef __KERNEL__
+
+struct mtp_data_header {
+ /* length of packet, including this header */
+ uint32_t length;
+ /* container type (2 for data packet) */
+ uint16_t type;
+ /* MTP command code */
+ uint16_t command;
+ /* MTP transaction ID */
+ uint32_t transaction_id;
+};
+
+#endif /* __KERNEL__ */
struct mtp_file_range {
/* file descriptor for file to transfer */
@@ -26,6 +42,14 @@ struct mtp_file_range {
loff_t offset;
/* number of bytes to transfer */
int64_t length;
+ /* MTP command ID for data header,
+ * used only for MTP_SEND_FILE_WITH_HEADER
+ */
+ uint16_t command;
+ /* MTP transaction ID for data header,
+ * used only for MTP_SEND_FILE_WITH_HEADER
+ */
+ uint32_t transaction_id;
};
struct mtp_event {
@@ -43,5 +67,9 @@ struct mtp_event {
#define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
/* Sends an event to the host via the interrupt endpoint */
#define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
+/* Sends the specified file range to the host,
+ * with a 12 byte MTP data packet header at the beginning.
+ */
+#define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
#endif /* __LINUX_USB_F_MTP_H */