summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-12-02 13:58:28 +0800
committerAndy Green <andy.green@linaro.org>2011-12-02 13:58:28 +0800
commit761295be9222c2ca8a896b7963b486627f41859c (patch)
treea48fc7bf7aa4d110fd8e6373949c2285f0e82e90 /include
parent623c44c65d67b0f60cfce3e0df71c53290f148d1 (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 */