1 /*****************************************************************************/
4 * usbdevice_fs.h -- USB device file system.
7 * Thomas Sailer (sailer@ife.ee.ethz.ch)
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * 0.1 04.01.2000 Created
27 /*****************************************************************************/
29 #ifndef _LINUX_USBDEVICE_FS_H
30 #define _LINUX_USBDEVICE_FS_H
32 #include <linux/types.h>
33 #include <linux/magic.h>
35 /* --------------------------------------------------------------------- */
37 /* usbdevfs ioctl codes */
39 struct usbdevfs_ctrltransfer {
45 __u32 timeout; /* in milliseconds */
49 struct usbdevfs_bulktransfer {
52 unsigned int timeout; /* in milliseconds */
56 struct usbdevfs_setinterface {
57 unsigned int interface;
58 unsigned int altsetting;
61 struct usbdevfs_disconnectsignal {
66 #define USBDEVFS_MAXDRIVERNAME 255
68 struct usbdevfs_getdriver {
69 unsigned int interface;
70 char driver[USBDEVFS_MAXDRIVERNAME + 1];
73 struct usbdevfs_connectinfo {
78 #define USBDEVFS_URB_SHORT_NOT_OK 0x01
79 #define USBDEVFS_URB_ISO_ASAP 0x02
80 #define USBDEVFS_URB_BULK_CONTINUATION 0x04
81 #define USBDEVFS_URB_NO_FSBR 0x20
82 #define USBDEVFS_URB_ZERO_PACKET 0x40
83 #define USBDEVFS_URB_NO_INTERRUPT 0x80
85 #define USBDEVFS_URB_TYPE_ISO 0
86 #define USBDEVFS_URB_TYPE_INTERRUPT 1
87 #define USBDEVFS_URB_TYPE_CONTROL 2
88 #define USBDEVFS_URB_TYPE_BULK 3
90 struct usbdevfs_iso_packet_desc {
92 unsigned int actual_length;
98 unsigned char endpoint;
105 int number_of_packets;
107 unsigned int signr; /* signal to be sent on completion,
108 or 0 if none should be sent. */
109 void __user *usercontext;
110 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
113 /* ioctls for talking directly to drivers */
114 struct usbdevfs_ioctl {
115 int ifno; /* interface 0..N ; negative numbers reserved */
116 int ioctl_code; /* MUST encode size + direction of data so the
117 * macros in <asm/ioctl.h> give correct values */
118 void __user *data; /* param buffer (in, or out) */
121 /* You can do most things with hubs just through control messages,
122 * except find out what device connects to what port. */
123 struct usbdevfs_hub_portinfo {
124 char nports; /* number of downstream ports in this hub */
125 char port [127]; /* e.g. port 3 connects to device 27 */
130 #include <linux/compat.h>
132 struct usbdevfs_ctrltransfer32 {
138 u32 timeout; /* in milliseconds */
142 struct usbdevfs_bulktransfer32 {
145 compat_uint_t timeout; /* in milliseconds */
149 struct usbdevfs_disconnectsignal32 {
151 compat_caddr_t context;
154 struct usbdevfs_urb32 {
156 unsigned char endpoint;
159 compat_caddr_t buffer;
160 compat_int_t buffer_length;
161 compat_int_t actual_length;
162 compat_int_t start_frame;
163 compat_int_t number_of_packets;
164 compat_int_t error_count;
166 compat_caddr_t usercontext; /* unused */
167 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
170 struct usbdevfs_ioctl32 {
176 #endif /* __KERNEL__ */
178 #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
179 #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
180 #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
181 #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
182 #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
183 #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
184 #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
185 #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
186 #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
187 #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
188 #define USBDEVFS_DISCARDURB _IO('U', 11)
189 #define USBDEVFS_REAPURB _IOW('U', 12, void *)
190 #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
191 #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
192 #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
193 #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
194 #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
195 #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
196 #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
197 #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
198 #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
199 #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
200 #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
201 #define USBDEVFS_RESET _IO('U', 20)
202 #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
203 #define USBDEVFS_DISCONNECT _IO('U', 22)
204 #define USBDEVFS_CONNECT _IO('U', 23)
205 #define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
206 #define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
207 #endif /* _LINUX_USBDEVICE_FS_H */