blob: 426c6b5cc06a58905d722fda8d281f168e43d820 [file] [log] [blame]
Mike Lockwood56118b52010-05-11 17:16:59 -04001/*
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 __LINUX_USB_F_MTP_H
19#define __LINUX_USB_F_MTP_H
20
Mike Lockwood9eff99e2010-05-16 16:39:32 -040021/* Constants for MTP_SET_INTERFACE_MODE */
22#define MTP_INTERFACE_MODE_MTP 0
23#define MTP_INTERFACE_MODE_PTP 1
24
25
Mike Lockwood56118b52010-05-11 17:16:59 -040026struct mtp_file_range {
Mike Lockwood42dbfa52010-06-22 15:03:53 -040027 /* file descriptor for file to transfer */
28 int fd;
Mike Lockwood56118b52010-05-11 17:16:59 -040029 /* offset in file for start of transfer */
30 loff_t offset;
31 /* number of bytes to transfer */
32 size_t length;
33};
34
Mike Lockwoodbe125a52010-07-12 18:54:16 -040035struct mtp_event {
36 /* size of the event */
37 size_t length;
38 /* event data to send */
39 void *data;
40};
41
Mike Lockwood56118b52010-05-11 17:16:59 -040042/* Sends the specified file range to the host */
43#define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
44/* Receives data from the host and writes it to a file.
45 * The file is created if it does not exist.
46 */
47#define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
Mike Lockwood9eff99e2010-05-16 16:39:32 -040048/* Sets the driver mode to either MTP or PTP */
49#define MTP_SET_INTERFACE_MODE _IOW('M', 2, int)
Mike Lockwoodbe125a52010-07-12 18:54:16 -040050/* Sends an event to the host via the interrupt endpoint */
51#define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
Mike Lockwood56118b52010-05-11 17:16:59 -040052
53#endif /* __LINUX_USB_F_MTP_H */