Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /*****************************************************************************/ |
2 | ||
3 | /* | |
4 | * usbdevice_fs.h -- USB device file system. | |
5 | * | |
6 | * Copyright (C) 2000 | |
7 | * Thomas Sailer (sailer@ife.ee.ethz.ch) | |
8 | * | |
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. | |
13 | * | |
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. | |
18 | * | |
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. | |
22 | * | |
23 | * History: | |
24 | * 0.1 04.01.2000 Created | |
1da177e4 LT |
25 | */ |
26 | ||
27 | /*****************************************************************************/ | |
28 | ||
29 | #ifndef _LINUX_USBDEVICE_FS_H | |
30 | #define _LINUX_USBDEVICE_FS_H | |
31 | ||
32 | #include <linux/types.h> | |
e18fa700 | 33 | #include <linux/magic.h> |
1da177e4 LT |
34 | |
35 | /* --------------------------------------------------------------------- */ | |
36 | ||
1da177e4 LT |
37 | /* usbdevfs ioctl codes */ |
38 | ||
39 | struct usbdevfs_ctrltransfer { | |
40 | __u8 bRequestType; | |
41 | __u8 bRequest; | |
42 | __u16 wValue; | |
43 | __u16 wIndex; | |
44 | __u16 wLength; | |
45 | __u32 timeout; /* in milliseconds */ | |
46 | void __user *data; | |
47 | }; | |
48 | ||
49 | struct usbdevfs_bulktransfer { | |
50 | unsigned int ep; | |
51 | unsigned int len; | |
52 | unsigned int timeout; /* in milliseconds */ | |
53 | void __user *data; | |
54 | }; | |
55 | ||
56 | struct usbdevfs_setinterface { | |
57 | unsigned int interface; | |
58 | unsigned int altsetting; | |
59 | }; | |
60 | ||
61 | struct usbdevfs_disconnectsignal { | |
62 | unsigned int signr; | |
63 | void __user *context; | |
64 | }; | |
65 | ||
66 | #define USBDEVFS_MAXDRIVERNAME 255 | |
67 | ||
68 | struct usbdevfs_getdriver { | |
69 | unsigned int interface; | |
70 | char driver[USBDEVFS_MAXDRIVERNAME + 1]; | |
71 | }; | |
72 | ||
73 | struct usbdevfs_connectinfo { | |
74 | unsigned int devnum; | |
75 | unsigned char slow; | |
76 | }; | |
77 | ||
14722ef4 AS |
78 | #define USBDEVFS_URB_SHORT_NOT_OK 0x01 |
79 | #define USBDEVFS_URB_ISO_ASAP 0x02 | |
80 | #define USBDEVFS_URB_NO_FSBR 0x20 | |
81 | #define USBDEVFS_URB_ZERO_PACKET 0x40 | |
82 | #define USBDEVFS_URB_NO_INTERRUPT 0x80 | |
1da177e4 LT |
83 | |
84 | #define USBDEVFS_URB_TYPE_ISO 0 | |
85 | #define USBDEVFS_URB_TYPE_INTERRUPT 1 | |
86 | #define USBDEVFS_URB_TYPE_CONTROL 2 | |
87 | #define USBDEVFS_URB_TYPE_BULK 3 | |
88 | ||
89 | struct usbdevfs_iso_packet_desc { | |
90 | unsigned int length; | |
91 | unsigned int actual_length; | |
92 | unsigned int status; | |
93 | }; | |
94 | ||
95 | struct usbdevfs_urb { | |
96 | unsigned char type; | |
97 | unsigned char endpoint; | |
98 | int status; | |
99 | unsigned int flags; | |
100 | void __user *buffer; | |
101 | int buffer_length; | |
102 | int actual_length; | |
103 | int start_frame; | |
104 | int number_of_packets; | |
105 | int error_count; | |
bc59462b PE |
106 | unsigned int signr; /* signal to be sent on completion, |
107 | or 0 if none should be sent. */ | |
7f9705b0 | 108 | void __user *usercontext; |
1da177e4 LT |
109 | struct usbdevfs_iso_packet_desc iso_frame_desc[0]; |
110 | }; | |
111 | ||
112 | /* ioctls for talking directly to drivers */ | |
113 | struct usbdevfs_ioctl { | |
114 | int ifno; /* interface 0..N ; negative numbers reserved */ | |
115 | int ioctl_code; /* MUST encode size + direction of data so the | |
116 | * macros in <asm/ioctl.h> give correct values */ | |
117 | void __user *data; /* param buffer (in, or out) */ | |
118 | }; | |
119 | ||
120 | /* You can do most things with hubs just through control messages, | |
121 | * except find out what device connects to what port. */ | |
122 | struct usbdevfs_hub_portinfo { | |
123 | char nports; /* number of downstream ports in this hub */ | |
124 | char port [127]; /* e.g. port 3 connects to device 27 */ | |
125 | }; | |
126 | ||
eae19a76 | 127 | #ifdef __KERNEL__ |
1da177e4 | 128 | #ifdef CONFIG_COMPAT |
ce441594 | 129 | #include <linux/compat.h> |
1da177e4 LT |
130 | struct usbdevfs_urb32 { |
131 | unsigned char type; | |
132 | unsigned char endpoint; | |
133 | compat_int_t status; | |
134 | compat_uint_t flags; | |
135 | compat_caddr_t buffer; | |
136 | compat_int_t buffer_length; | |
137 | compat_int_t actual_length; | |
138 | compat_int_t start_frame; | |
139 | compat_int_t number_of_packets; | |
140 | compat_int_t error_count; | |
141 | compat_uint_t signr; | |
142 | compat_caddr_t usercontext; /* unused */ | |
143 | struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | |
144 | }; | |
c36fc889 PZ |
145 | |
146 | struct usbdevfs_ioctl32 { | |
147 | s32 ifno; | |
148 | s32 ioctl_code; | |
149 | compat_caddr_t data; | |
150 | }; | |
1da177e4 | 151 | #endif |
eae19a76 | 152 | #endif /* __KERNEL__ */ |
1da177e4 LT |
153 | |
154 | #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) | |
155 | #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) | |
156 | #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) | |
157 | #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) | |
158 | #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) | |
159 | #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) | |
160 | #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) | |
161 | #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) | |
162 | #define USBDEVFS_DISCARDURB _IO('U', 11) | |
163 | #define USBDEVFS_REAPURB _IOW('U', 12, void *) | |
fc8d9191 | 164 | #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32) |
1da177e4 | 165 | #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) |
fc8d9191 | 166 | #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) |
1da177e4 LT |
167 | #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) |
168 | #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) | |
169 | #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) | |
170 | #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) | |
171 | #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) | |
c36fc889 | 172 | #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32) |
1da177e4 LT |
173 | #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) |
174 | #define USBDEVFS_RESET _IO('U', 20) | |
175 | #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) | |
176 | #define USBDEVFS_DISCONNECT _IO('U', 22) | |
177 | #define USBDEVFS_CONNECT _IO('U', 23) | |
178 | #endif /* _LINUX_USBDEVICE_FS_H */ |