it's called bmRequestType
[platform/upstream/libusb.git] / libusb / os / linux_usbfs.h
1 /*
2  * usbfs header structures
3  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
4  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef __LIBUSB_USBFS_H__
22 #define __LIBUSB_USBFS_H__
23
24 struct usbfs_ctrltransfer {
25         /* keep in sync with usbdevice_fs.h:usbdevfs_ctrltransfer */
26         uint8_t  bmRequestType;
27         uint8_t  bRequest;
28         uint16_t wValue;
29         uint16_t wIndex;
30         uint16_t wLength;
31
32         uint32_t timeout;       /* in milliseconds */
33
34         /* pointer to data */
35         void *data;
36 };
37
38 struct usbfs_bulktransfer {
39         /* keep in sync with usbdevice_fs.h:usbdevfs_bulktransfer */
40         unsigned int ep;
41         unsigned int len;
42         unsigned int timeout;   /* in milliseconds */
43
44         /* pointer to data */
45         void *data;
46 };
47
48 struct usbfs_setinterface {
49         /* keep in sync with usbdevice_fs.h:usbdevfs_setinterface */
50         unsigned int interface;
51         unsigned int altsetting;
52 };
53
54 #define USBFS_MAXDRIVERNAME 255
55
56 struct usbfs_getdriver {
57         unsigned int interface;
58         char driver[USBFS_MAXDRIVERNAME + 1];
59 };
60
61 #define USBFS_URB_DISABLE_SPD   1
62 #define USBFS_URB_ISO_ASAP      2
63 #define USBFS_URB_QUEUE_BULK    0x10
64
65 enum usbfs_urb_type {
66         USBFS_URB_TYPE_ISO = 0,
67         USBFS_URB_TYPE_INTERRUPT = 1,
68         USBFS_URB_TYPE_CONTROL = 2,
69         USBFS_URB_TYPE_BULK = 3,
70 };
71
72 struct usbfs_iso_packet_desc {
73         unsigned int length;
74         unsigned int actual_length;
75         unsigned int status;
76 };
77
78 #define MAX_URB_BUFFER_LENGTH           16384
79
80 struct usbfs_urb {
81         unsigned char type;
82         unsigned char endpoint;
83         int status;
84         unsigned int flags;
85         void *buffer;
86         int buffer_length;
87         int actual_length;
88         int start_frame;
89         int number_of_packets;
90         int error_count;
91         unsigned int signr;
92         void *usercontext;
93         struct usbfs_iso_packet_desc iso_frame_desc[0];
94 };
95
96 struct usbfs_connectinfo {
97         unsigned int devnum;
98         unsigned char slow;
99 };
100
101 struct usbfs_ioctl {
102         int ifno;       /* interface 0..N ; negative numbers reserved */
103         int ioctl_code; /* MUST encode size + direction of data so the
104                          * macros in <asm/ioctl.h> give correct values */
105         void *data;     /* param buffer (in, or out) */
106 };
107
108 struct usbfs_hub_portinfo {
109         unsigned char numports;
110         unsigned char port[127];        /* port to device num mapping */
111 };
112
113 #define IOCTL_USBFS_CONTROL     _IOWR('U', 0, struct usbfs_ctrltransfer)
114 #define IOCTL_USBFS_BULK                _IOWR('U', 2, struct usbfs_bulktransfer)
115 #define IOCTL_USBFS_RESETEP     _IOR('U', 3, unsigned int)
116 #define IOCTL_USBFS_SETINTF     _IOR('U', 4, struct usbfs_setinterface)
117 #define IOCTL_USBFS_SETCONFIG   _IOR('U', 5, unsigned int)
118 #define IOCTL_USBFS_GETDRIVER   _IOW('U', 8, struct usbfs_getdriver)
119 #define IOCTL_USBFS_SUBMITURB   _IOR('U', 10, struct usbfs_urb)
120 #define IOCTL_USBFS_DISCARDURB  _IO('U', 11)
121 #define IOCTL_USBFS_REAPURB     _IOW('U', 12, void *)
122 #define IOCTL_USBFS_REAPURBNDELAY       _IOW('U', 13, void *)
123 #define IOCTL_USBFS_CLAIMINTF   _IOR('U', 15, unsigned int)
124 #define IOCTL_USBFS_RELEASEINTF _IOR('U', 16, unsigned int)
125 #define IOCTL_USBFS_CONNECTINFO _IOW('U', 17, struct usbfs_connectinfo)
126 #define IOCTL_USBFS_IOCTL         _IOWR('U', 18, struct usbfs_ioctl)
127 #define IOCTL_USBFS_HUB_PORTINFO        _IOR('U', 19, struct usbfs_hub_portinfo)
128 #define IOCTL_USBFS_RESET               _IO('U', 20)
129 #define IOCTL_USBFS_CLEAR_HALT  _IOR('U', 21, unsigned int)
130 #define IOCTL_USBFS_DISCONNECT  _IO('U', 22)
131 #define IOCTL_USBFS_CONNECT     _IO('U', 23)
132
133 #endif