1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*****************************************************************************/
5 * usbdevice_fs.h -- USB device file system.
8 * Thomas Sailer (sailer@ife.ee.ethz.ch)
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * 0.1 04.01.2000 Created
28 /*****************************************************************************/
30 #ifndef _UAPI_LINUX_USBDEVICE_FS_H
31 #define _UAPI_LINUX_USBDEVICE_FS_H
33 #include <linux/types.h>
34 #include <linux/magic.h>
36 /* --------------------------------------------------------------------- */
38 /* usbdevfs ioctl codes */
40 struct usbdevfs_ctrltransfer
{
46 __u32 timeout
; /* in milliseconds */
50 struct usbdevfs_bulktransfer
{
53 unsigned int timeout
; /* in milliseconds */
57 struct usbdevfs_setinterface
{
58 unsigned int interface
;
59 unsigned int altsetting
;
62 struct usbdevfs_disconnectsignal
{
67 #define USBDEVFS_MAXDRIVERNAME 255
69 struct usbdevfs_getdriver
{
70 unsigned int interface
;
71 char driver
[USBDEVFS_MAXDRIVERNAME
+ 1];
74 struct usbdevfs_connectinfo
{
79 #define USBDEVFS_URB_SHORT_NOT_OK 0x01
80 #define USBDEVFS_URB_ISO_ASAP 0x02
81 #define USBDEVFS_URB_BULK_CONTINUATION 0x04
82 #define USBDEVFS_URB_NO_FSBR 0x20 /* Not used */
83 #define USBDEVFS_URB_ZERO_PACKET 0x40
84 #define USBDEVFS_URB_NO_INTERRUPT 0x80
86 #define USBDEVFS_URB_TYPE_ISO 0
87 #define USBDEVFS_URB_TYPE_INTERRUPT 1
88 #define USBDEVFS_URB_TYPE_CONTROL 2
89 #define USBDEVFS_URB_TYPE_BULK 3
91 struct usbdevfs_iso_packet_desc
{
93 unsigned int actual_length
;
99 unsigned char endpoint
;
107 int number_of_packets
; /* Only used for isoc urbs */
108 unsigned int stream_id
; /* Only used with bulk streams */
111 unsigned int signr
; /* signal to be sent on completion,
112 or 0 if none should be sent. */
113 void __user
*usercontext
;
114 struct usbdevfs_iso_packet_desc iso_frame_desc
[0];
117 /* ioctls for talking directly to drivers */
118 struct usbdevfs_ioctl
{
119 int ifno
; /* interface 0..N ; negative numbers reserved */
120 int ioctl_code
; /* MUST encode size + direction of data so the
121 * macros in <asm/ioctl.h> give correct values */
122 void __user
*data
; /* param buffer (in, or out) */
125 /* You can do most things with hubs just through control messages,
126 * except find out what device connects to what port. */
127 struct usbdevfs_hub_portinfo
{
128 char nports
; /* number of downstream ports in this hub */
129 char port
[127]; /* e.g. port 3 connects to device 27 */
132 /* System and bus capability flags */
133 #define USBDEVFS_CAP_ZERO_PACKET 0x01
134 #define USBDEVFS_CAP_BULK_CONTINUATION 0x02
135 #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
136 #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08
137 #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10
138 #define USBDEVFS_CAP_MMAP 0x20
139 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40
141 /* USBDEVFS_DISCONNECT_CLAIM flags & struct */
143 /* disconnect-and-claim if the driver matches the driver field */
144 #define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
145 /* disconnect-and-claim except when the driver matches the driver field */
146 #define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
148 struct usbdevfs_disconnect_claim
{
149 unsigned int interface
;
151 char driver
[USBDEVFS_MAXDRIVERNAME
+ 1];
154 struct usbdevfs_streams
{
155 unsigned int num_streams
; /* Not used by USBDEVFS_FREE_STREAMS */
156 unsigned int num_eps
;
157 unsigned char eps
[0];
161 * USB_SPEED_* values returned by USBDEVFS_GET_SPEED are defined in
165 #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
166 #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
167 #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
168 #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
169 #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
170 #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
171 #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
172 #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
173 #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
174 #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
175 #define USBDEVFS_DISCARDURB _IO('U', 11)
176 #define USBDEVFS_REAPURB _IOW('U', 12, void *)
177 #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
178 #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
179 #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
180 #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
181 #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
182 #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
183 #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
184 #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
185 #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
186 #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
187 #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
188 #define USBDEVFS_RESET _IO('U', 20)
189 #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
190 #define USBDEVFS_DISCONNECT _IO('U', 22)
191 #define USBDEVFS_CONNECT _IO('U', 23)
192 #define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
193 #define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
194 #define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
195 #define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim)
196 #define USBDEVFS_ALLOC_STREAMS _IOR('U', 28, struct usbdevfs_streams)
197 #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams)
198 #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32)
199 #define USBDEVFS_GET_SPEED _IO('U', 31)
201 #endif /* _UAPI_LINUX_USBDEVICE_FS_H */