aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_mtp.h
blob: 00a30b7132ce71fd482c258fd52872d8c6adf678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Gadget Driver for Android MTP
 *
 * Copyright (C) 2009 Samsung Electronics.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __F_MTP_H
#define __F_MTP_H


#define MTP_MAX_PACKET_LEN_FROM_APP 22

#define	MTP_ACM_ENABLE		0
#define	MTP_ONLY_ENABLE		1
#define	MTP_DISABLE		2
#define	MTP_CLEAR_HALT		3
#define	MTP_WRITE_INT_DATA	4
#define SET_MTP_USER_PID	5
#define GET_SETUP_DATA		6
#define SET_SETUP_DATA		7
#define SEND_RESET_ACK		8
#define SET_ZLP_DATA		9
#define GET_HIGH_FULL_SPEED	10
#define SEND_FILE_WITH_HEADER 11
#define SIG_SETUP		44

/*PIMA15740-2000 spec*/
#define USB_PTPREQUEST_CANCELIO   0x64    /* Cancel request */
#define USB_PTPREQUEST_GETEVENT   0x65    /* Get extened event data */
#define USB_PTPREQUEST_RESET      0x66    /* Reset Device */
#define USB_PTPREQUEST_GETSTATUS  0x67    /* Get Device Status */
#define USB_PTPREQUEST_CANCELIO_SIZE 6
#define USB_PTPREQUEST_GETSTATUS_SIZE 12



int mtp_function_add(struct usb_configuration *c);
int mtp_function_config_changed(struct usb_composite_dev *cdev,
		struct usb_configuration *c);
int mtp_enable(void);
void mtp_function_enable(int enable);

struct usb_mtp_ctrlrequest {
	struct usb_ctrlrequest	setup;
};


struct usb_container_header {
	uint32_t  Length;/* the valid size, in BYTES, of the container  */
	uint16_t   Type;/* Container type */
	uint16_t   Code;/* Operation code, response code, or Event code */
	uint32_t  TransactionID;/* host generated number */
};

struct read_send_info {
	int	Fd;/* Media File fd */
	uint64_t Length;/* the valid size, in BYTES, of the container  */
	uint16_t Code;/* Operation code, response code, or Event code */
	uint32_t TransactionID;/* host generated number */
};


#endif /* __F_MTP_H */