Colin Cross | 2453dad | 2013-11-07 13:08:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Gadget Function Driver for MTP |
| 3 | * |
| 4 | * Copyright (C) 2010 Google, Inc. |
| 5 | * Author: Mike Lockwood <lockwood@android.com> |
| 6 | * |
| 7 | * This software is licensed under the terms of the GNU General Public |
| 8 | * License version 2, as published by the Free Software Foundation, and |
| 9 | * may be copied, distributed, and modified under those terms. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #ifndef _UAPI_LINUX_USB_F_MTP_H |
| 19 | #define _UAPI_LINUX_USB_F_MTP_H |
| 20 | |
| 21 | #include <linux/ioctl.h> |
| 22 | #include <linux/types.h> |
| 23 | |
| 24 | struct mtp_file_range { |
| 25 | /* file descriptor for file to transfer */ |
| 26 | int fd; |
| 27 | /* offset in file for start of transfer */ |
| 28 | loff_t offset; |
| 29 | /* number of bytes to transfer */ |
| 30 | int64_t length; |
| 31 | /* MTP command ID for data header, |
| 32 | * used only for MTP_SEND_FILE_WITH_HEADER |
| 33 | */ |
| 34 | uint16_t command; |
| 35 | /* MTP transaction ID for data header, |
| 36 | * used only for MTP_SEND_FILE_WITH_HEADER |
| 37 | */ |
| 38 | uint32_t transaction_id; |
| 39 | }; |
| 40 | |
| 41 | struct mtp_event { |
| 42 | /* size of the event */ |
| 43 | size_t length; |
| 44 | /* event data to send */ |
| 45 | void *data; |
| 46 | }; |
| 47 | |
| 48 | /* Sends the specified file range to the host */ |
| 49 | #define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range) |
| 50 | /* Receives data from the host and writes it to a file. |
| 51 | * The file is created if it does not exist. |
| 52 | */ |
| 53 | #define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range) |
| 54 | /* Sends an event to the host via the interrupt endpoint */ |
| 55 | #define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event) |
| 56 | /* Sends the specified file range to the host, |
| 57 | * with a 12 byte MTP data packet header at the beginning. |
| 58 | */ |
| 59 | #define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range) |
| 60 | |
| 61 | #endif /* _UAPI_LINUX_USB_F_MTP_H */ |