xref: /freebsd/sys/dev/usb/usb_ioctl.h (revision 62a963c5f5517c6ab637c8655cdc16ab6ac07416)
102ac6454SAndrew Thompson /* $FreeBSD$ */
202ac6454SAndrew Thompson /*-
302ac6454SAndrew Thompson  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
402ac6454SAndrew Thompson  * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
502ac6454SAndrew Thompson  * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
602ac6454SAndrew Thompson  *
702ac6454SAndrew Thompson  * Redistribution and use in source and binary forms, with or without
802ac6454SAndrew Thompson  * modification, are permitted provided that the following conditions
902ac6454SAndrew Thompson  * are met:
1002ac6454SAndrew Thompson  * 1. Redistributions of source code must retain the above copyright
1102ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer.
1202ac6454SAndrew Thompson  * 2. Redistributions in binary form must reproduce the above copyright
1302ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer in the
1402ac6454SAndrew Thompson  *    documentation and/or other materials provided with the distribution.
1502ac6454SAndrew Thompson  *
1602ac6454SAndrew Thompson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1702ac6454SAndrew Thompson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1802ac6454SAndrew Thompson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1902ac6454SAndrew Thompson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2002ac6454SAndrew Thompson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2102ac6454SAndrew Thompson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2202ac6454SAndrew Thompson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2302ac6454SAndrew Thompson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2402ac6454SAndrew Thompson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2502ac6454SAndrew Thompson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2602ac6454SAndrew Thompson  * SUCH DAMAGE.
2702ac6454SAndrew Thompson  */
2802ac6454SAndrew Thompson 
2975973647SAndrew Thompson #ifndef _USB_IOCTL_H_
3075973647SAndrew Thompson #define	_USB_IOCTL_H_
3102ac6454SAndrew Thompson 
32d2b99310SHans Petter Selasky #ifndef USB_GLOBAL_INCLUDE_FILE
3302ac6454SAndrew Thompson #include <sys/ioccom.h>
34*62a963c5SHans Petter Selasky #include <sys/cdefs.h>
3502ac6454SAndrew Thompson 
3602ac6454SAndrew Thompson /* Building "kdump" depends on these includes */
3702ac6454SAndrew Thompson 
3802ac6454SAndrew Thompson #include <dev/usb/usb_endian.h>
3902ac6454SAndrew Thompson #include <dev/usb/usb.h>
40d2b99310SHans Petter Selasky #endif
4102ac6454SAndrew Thompson 
42ee3e3ff5SAndrew Thompson #define	USB_DEVICE_NAME "usbctl"
43ee3e3ff5SAndrew Thompson #define	USB_DEVICE_DIR "usb"
4402ac6454SAndrew Thompson #define	USB_GENERIC_NAME "ugen"
45399e6543SHans Petter Selasky #define	USB_TEMPLATE_SYSCTL "hw.usb.template"	/* integer type */
46399e6543SHans Petter Selasky 
47*62a963c5SHans Petter Selasky /*
48*62a963c5SHans Petter Selasky  * Align IOCTL structures to hide differences when running 32-bit
49*62a963c5SHans Petter Selasky  * programs under 64-bit kernels:
50*62a963c5SHans Petter Selasky  */
51*62a963c5SHans Petter Selasky #ifdef COMPAT_32BIT
52*62a963c5SHans Petter Selasky #define	USB_IOCTL_STRUCT_ALIGN(n) __aligned(n)
53*62a963c5SHans Petter Selasky #else
54*62a963c5SHans Petter Selasky #define	USB_IOCTL_STRUCT_ALIGN(n)
55*62a963c5SHans Petter Selasky #endif
56*62a963c5SHans Petter Selasky 
57399e6543SHans Petter Selasky /* Definition of valid template sysctl values */
58399e6543SHans Petter Selasky 
59399e6543SHans Petter Selasky enum {
60399e6543SHans Petter Selasky 	USB_TEMP_MSC,		/* USB Mass Storage */
61399e6543SHans Petter Selasky 	USB_TEMP_CDCE,		/* USB CDC Ethernet */
62399e6543SHans Petter Selasky 	USB_TEMP_MTP,		/* Message Transfer Protocol */
63399e6543SHans Petter Selasky 	USB_TEMP_MODEM,		/* USB CDC Modem */
64399e6543SHans Petter Selasky 	USB_TEMP_AUDIO,		/* USB Audio */
65399e6543SHans Petter Selasky 	USB_TEMP_KBD,		/* USB Keyboard */
66399e6543SHans Petter Selasky 	USB_TEMP_MOUSE,		/* USB Mouse */
67399e6543SHans Petter Selasky 	USB_TEMP_MAX,
68399e6543SHans Petter Selasky };
6902ac6454SAndrew Thompson 
70760bc48eSAndrew Thompson struct usb_read_dir {
7151fd3d75SHans Petter Selasky #ifdef COMPAT_32BIT
7251fd3d75SHans Petter Selasky 	uint64_t urd_data;
7351fd3d75SHans Petter Selasky #else
7402ac6454SAndrew Thompson 	void   *urd_data;
7551fd3d75SHans Petter Selasky #endif
7602ac6454SAndrew Thompson 	uint32_t urd_startentry;
7702ac6454SAndrew Thompson 	uint32_t urd_maxlen;
78*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(8);
7902ac6454SAndrew Thompson 
80760bc48eSAndrew Thompson struct usb_ctl_request {
8151fd3d75SHans Petter Selasky #ifdef COMPAT_32BIT
8251fd3d75SHans Petter Selasky 	uint64_t ucr_data;
8351fd3d75SHans Petter Selasky #else
8402ac6454SAndrew Thompson 	void   *ucr_data;
8551fd3d75SHans Petter Selasky #endif
8602ac6454SAndrew Thompson 	uint16_t ucr_flags;
8702ac6454SAndrew Thompson 	uint16_t ucr_actlen;		/* actual length transferred */
8802ac6454SAndrew Thompson 	uint8_t	ucr_addr;		/* zero - currently not used */
89760bc48eSAndrew Thompson 	struct usb_device_request ucr_request;
90*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(8);
9102ac6454SAndrew Thompson 
92760bc48eSAndrew Thompson struct usb_alt_interface {
9302ac6454SAndrew Thompson 	uint8_t	uai_interface_index;
9402ac6454SAndrew Thompson 	uint8_t	uai_alt_index;
95*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
9602ac6454SAndrew Thompson 
97760bc48eSAndrew Thompson struct usb_gen_descriptor {
9851fd3d75SHans Petter Selasky #ifdef COMPAT_32BIT
9951fd3d75SHans Petter Selasky 	uint64_t ugd_data;
10051fd3d75SHans Petter Selasky #else
10102ac6454SAndrew Thompson 	void   *ugd_data;
10251fd3d75SHans Petter Selasky #endif
10302ac6454SAndrew Thompson 	uint16_t ugd_lang_id;
10402ac6454SAndrew Thompson 	uint16_t ugd_maxlen;
10502ac6454SAndrew Thompson 	uint16_t ugd_actlen;
10602ac6454SAndrew Thompson 	uint16_t ugd_offset;
10702ac6454SAndrew Thompson 	uint8_t	ugd_config_index;
10802ac6454SAndrew Thompson 	uint8_t	ugd_string_index;
10902ac6454SAndrew Thompson 	uint8_t	ugd_iface_index;
11002ac6454SAndrew Thompson 	uint8_t	ugd_altif_index;
11102ac6454SAndrew Thompson 	uint8_t	ugd_endpt_index;
11202ac6454SAndrew Thompson 	uint8_t	ugd_report_type;
11302ac6454SAndrew Thompson 	uint8_t	reserved[8];
114*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(8);
11502ac6454SAndrew Thompson 
116760bc48eSAndrew Thompson struct usb_device_info {
11702ac6454SAndrew Thompson 	uint16_t udi_productNo;
11802ac6454SAndrew Thompson 	uint16_t udi_vendorNo;
11902ac6454SAndrew Thompson 	uint16_t udi_releaseNo;
12002ac6454SAndrew Thompson 	uint16_t udi_power;		/* power consumption in mA, 0 if
12102ac6454SAndrew Thompson 					 * selfpowered */
12202ac6454SAndrew Thompson 	uint8_t	udi_bus;
12302ac6454SAndrew Thompson 	uint8_t	udi_addr;		/* device address */
12402ac6454SAndrew Thompson 	uint8_t	udi_index;		/* device index */
12502ac6454SAndrew Thompson 	uint8_t	udi_class;
12602ac6454SAndrew Thompson 	uint8_t	udi_subclass;
12702ac6454SAndrew Thompson 	uint8_t	udi_protocol;
12802ac6454SAndrew Thompson 	uint8_t	udi_config_no;		/* current config number */
12902ac6454SAndrew Thompson 	uint8_t	udi_config_index;	/* current config index */
13002ac6454SAndrew Thompson 	uint8_t	udi_speed;		/* see "USB_SPEED_XXX" */
13102ac6454SAndrew Thompson 	uint8_t	udi_mode;		/* see "USB_MODE_XXX" */
13202ac6454SAndrew Thompson 	uint8_t	udi_nports;
13302ac6454SAndrew Thompson 	uint8_t	udi_hubaddr;		/* parent HUB address */
13402ac6454SAndrew Thompson 	uint8_t	udi_hubindex;		/* parent HUB device index */
13502ac6454SAndrew Thompson 	uint8_t	udi_hubport;		/* parent HUB port */
13602ac6454SAndrew Thompson 	uint8_t	udi_power_mode;		/* see "USB_POWER_MODE_XXX" */
13702ac6454SAndrew Thompson 	uint8_t	udi_suspended;		/* set if device is suspended */
13802ac6454SAndrew Thompson 	uint8_t	udi_reserved[16];	/* leave space for the future */
13902ac6454SAndrew Thompson 	char	udi_product[128];
14002ac6454SAndrew Thompson 	char	udi_vendor[128];
14102ac6454SAndrew Thompson 	char	udi_serial[64];
14202ac6454SAndrew Thompson 	char	udi_release[8];
143*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(2);
14402ac6454SAndrew Thompson 
145c77a24c2SHans Petter Selasky #define	USB_DEVICE_PORT_PATH_MAX 32
146c77a24c2SHans Petter Selasky 
147c77a24c2SHans Petter Selasky struct usb_device_port_path {
148c77a24c2SHans Petter Selasky 	uint8_t udp_bus;		/* which bus we are on */
149c77a24c2SHans Petter Selasky 	uint8_t udp_index;		/* which device index */
150c77a24c2SHans Petter Selasky 	uint8_t udp_port_level;		/* how many levels: 0, 1, 2 ... */
151c77a24c2SHans Petter Selasky 	uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX];
152*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
153c77a24c2SHans Petter Selasky 
154760bc48eSAndrew Thompson struct usb_device_stats {
15502ac6454SAndrew Thompson 	uint32_t uds_requests_ok[4];	/* Indexed by transfer type UE_XXX */
15602ac6454SAndrew Thompson 	uint32_t uds_requests_fail[4];	/* Indexed by transfer type UE_XXX */
157*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(4);
15802ac6454SAndrew Thompson 
159760bc48eSAndrew Thompson struct usb_fs_start {
16002ac6454SAndrew Thompson 	uint8_t	ep_index;
161*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
16202ac6454SAndrew Thompson 
163760bc48eSAndrew Thompson struct usb_fs_stop {
16402ac6454SAndrew Thompson 	uint8_t	ep_index;
165*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
16602ac6454SAndrew Thompson 
167760bc48eSAndrew Thompson struct usb_fs_complete {
16802ac6454SAndrew Thompson 	uint8_t	ep_index;
169*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
17002ac6454SAndrew Thompson 
17102ac6454SAndrew Thompson /* This structure is used for all endpoint types */
172760bc48eSAndrew Thompson struct usb_fs_endpoint {
17302ac6454SAndrew Thompson 	/*
17402ac6454SAndrew Thompson 	 * NOTE: isochronous USB transfer only use one buffer, but can have
17502ac6454SAndrew Thompson 	 * multiple frame lengths !
17602ac6454SAndrew Thompson 	 */
17751fd3d75SHans Petter Selasky #ifdef COMPAT_32BIT
17851fd3d75SHans Petter Selasky 	uint64_t ppBuffer;
17951fd3d75SHans Petter Selasky 	uint64_t pLength;
18051fd3d75SHans Petter Selasky #else
18102ac6454SAndrew Thompson 	void  **ppBuffer;		/* pointer to userland buffers */
18202ac6454SAndrew Thompson 	uint32_t *pLength;		/* pointer to frame lengths, updated
18302ac6454SAndrew Thompson 					 * to actual length */
18451fd3d75SHans Petter Selasky #endif
18502ac6454SAndrew Thompson 	uint32_t nFrames;		/* number of frames */
18602ac6454SAndrew Thompson 	uint32_t aFrames;		/* actual number of frames */
18702ac6454SAndrew Thompson 	uint16_t flags;
18802ac6454SAndrew Thompson 	/* a single short frame will terminate */
18902ac6454SAndrew Thompson #define	USB_FS_FLAG_SINGLE_SHORT_OK 0x0001
19002ac6454SAndrew Thompson 	/* multiple short frames are allowed */
19102ac6454SAndrew Thompson #define	USB_FS_FLAG_MULTI_SHORT_OK 0x0002
19202ac6454SAndrew Thompson 	/* all frame(s) transmitted are short terminated */
19302ac6454SAndrew Thompson #define	USB_FS_FLAG_FORCE_SHORT 0x0004
19402ac6454SAndrew Thompson 	/* will do a clear-stall before xfer */
19502ac6454SAndrew Thompson #define	USB_FS_FLAG_CLEAR_STALL 0x0008
19602ac6454SAndrew Thompson 	uint16_t timeout;		/* in milliseconds */
19702ac6454SAndrew Thompson 	/* isocronous completion time in milliseconds - used for echo cancel */
19802ac6454SAndrew Thompson 	uint16_t isoc_time_complete;
19902ac6454SAndrew Thompson 	/* timeout value for no timeout */
20002ac6454SAndrew Thompson #define	USB_FS_TIMEOUT_NONE 0
201ed6d949aSAndrew Thompson 	int	status;			/* see USB_ERR_XXX */
202*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(8);
20302ac6454SAndrew Thompson 
204760bc48eSAndrew Thompson struct usb_fs_init {
20502ac6454SAndrew Thompson 	/* userland pointer to endpoints structure */
20651fd3d75SHans Petter Selasky #ifdef COMPAT_32BIT
20751fd3d75SHans Petter Selasky 	uint64_t pEndpoints;
20851fd3d75SHans Petter Selasky #else
209760bc48eSAndrew Thompson 	struct usb_fs_endpoint *pEndpoints;
21051fd3d75SHans Petter Selasky #endif
21102ac6454SAndrew Thompson 	/* maximum number of endpoints */
21202ac6454SAndrew Thompson 	uint8_t	ep_index_max;
213*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(8);
21402ac6454SAndrew Thompson 
215760bc48eSAndrew Thompson struct usb_fs_uninit {
21602ac6454SAndrew Thompson 	uint8_t	dummy;			/* zero */
217*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
21802ac6454SAndrew Thompson 
219760bc48eSAndrew Thompson struct usb_fs_open {
22002ac6454SAndrew Thompson #define	USB_FS_MAX_BUFSIZE (1 << 18)
22102ac6454SAndrew Thompson 	uint32_t max_bufsize;
2221c497368SHans Petter Selasky #define	USB_FS_MAX_FRAMES		(1U << 12)
2231c497368SHans Petter Selasky #define	USB_FS_MAX_FRAMES_PRE_SCALE	(1U << 31)	/* for ISOCHRONOUS transfers */
2241c497368SHans Petter Selasky 	uint32_t max_frames;		/* read and write */
22502ac6454SAndrew Thompson 	uint16_t max_packet_length;	/* read only */
22602ac6454SAndrew Thompson 	uint8_t	dev_index;		/* currently unused */
22702ac6454SAndrew Thompson 	uint8_t	ep_index;
22802ac6454SAndrew Thompson 	uint8_t	ep_no;			/* bEndpointNumber */
229*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(4);
23002ac6454SAndrew Thompson 
231e9cec016SHans Petter Selasky struct usb_fs_open_stream {
232a5cf1aaaSHans Petter Selasky 	struct usb_fs_open fs_open;
233*62a963c5SHans Petter Selasky 	uint16_t stream_id;		/* stream ID */
234*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(4);
235a5cf1aaaSHans Petter Selasky 
236760bc48eSAndrew Thompson struct usb_fs_close {
23702ac6454SAndrew Thompson 	uint8_t	ep_index;
238*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
23902ac6454SAndrew Thompson 
240760bc48eSAndrew Thompson struct usb_fs_clear_stall_sync {
24102ac6454SAndrew Thompson 	uint8_t	ep_index;
242*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(1);
24302ac6454SAndrew Thompson 
244760bc48eSAndrew Thompson struct usb_gen_quirk {
24502ac6454SAndrew Thompson 	uint16_t index;			/* Quirk Index */
24602ac6454SAndrew Thompson 	uint16_t vid;			/* Vendor ID */
24702ac6454SAndrew Thompson 	uint16_t pid;			/* Product ID */
24802ac6454SAndrew Thompson 	uint16_t bcdDeviceLow;		/* Low Device Revision */
24902ac6454SAndrew Thompson 	uint16_t bcdDeviceHigh;		/* High Device Revision */
25002ac6454SAndrew Thompson 	uint16_t reserved[2];
25102ac6454SAndrew Thompson 	/*
252*62a963c5SHans Petter Selasky 	 * String version of quirk including terminating zero. See
253*62a963c5SHans Petter Selasky 	 * UQ_XXX in "usb_quirk.h".
25402ac6454SAndrew Thompson 	 */
25502ac6454SAndrew Thompson 	char	quirkname[64 - 14];
256*62a963c5SHans Petter Selasky } USB_IOCTL_STRUCT_ALIGN(2);
25702ac6454SAndrew Thompson 
25802ac6454SAndrew Thompson /* USB controller */
259760bc48eSAndrew Thompson #define	USB_REQUEST		_IOWR('U', 1, struct usb_ctl_request)
26002ac6454SAndrew Thompson #define	USB_SETDEBUG		_IOW ('U', 2, int)
26102ac6454SAndrew Thompson #define	USB_DISCOVER		_IO  ('U', 3)
262760bc48eSAndrew Thompson #define	USB_DEVICEINFO		_IOWR('U', 4, struct usb_device_info)
263760bc48eSAndrew Thompson #define	USB_DEVICESTATS		_IOR ('U', 5, struct usb_device_stats)
26402ac6454SAndrew Thompson #define	USB_DEVICEENUMERATE	_IOW ('U', 6, int)
26502ac6454SAndrew Thompson 
26602ac6454SAndrew Thompson /* Generic HID device */
267760bc48eSAndrew Thompson #define	USB_GET_REPORT_DESC	_IOWR('U', 21, struct usb_gen_descriptor)
26802ac6454SAndrew Thompson #define	USB_SET_IMMED		_IOW ('U', 22, int)
269760bc48eSAndrew Thompson #define	USB_GET_REPORT		_IOWR('U', 23, struct usb_gen_descriptor)
270760bc48eSAndrew Thompson #define	USB_SET_REPORT		_IOW ('U', 24, struct usb_gen_descriptor)
27102ac6454SAndrew Thompson #define	USB_GET_REPORT_ID	_IOR ('U', 25, int)
27202ac6454SAndrew Thompson 
27302ac6454SAndrew Thompson /* Generic USB device */
27402ac6454SAndrew Thompson #define	USB_GET_CONFIG		_IOR ('U', 100, int)
27502ac6454SAndrew Thompson #define	USB_SET_CONFIG		_IOW ('U', 101, int)
276760bc48eSAndrew Thompson #define	USB_GET_ALTINTERFACE	_IOWR('U', 102, struct usb_alt_interface)
277760bc48eSAndrew Thompson #define	USB_SET_ALTINTERFACE	_IOWR('U', 103, struct usb_alt_interface)
278760bc48eSAndrew Thompson #define	USB_GET_DEVICE_DESC	_IOR ('U', 105, struct usb_device_descriptor)
279760bc48eSAndrew Thompson #define	USB_GET_CONFIG_DESC	_IOR ('U', 106, struct usb_config_descriptor)
280760bc48eSAndrew Thompson #define	USB_GET_RX_INTERFACE_DESC _IOR ('U', 107, struct usb_interface_descriptor)
281760bc48eSAndrew Thompson #define	USB_GET_RX_ENDPOINT_DESC _IOR ('U', 108, struct usb_endpoint_descriptor)
282760bc48eSAndrew Thompson #define	USB_GET_FULL_DESC	_IOWR('U', 109, struct usb_gen_descriptor)
283760bc48eSAndrew Thompson #define	USB_GET_STRING_DESC	_IOWR('U', 110, struct usb_gen_descriptor)
284760bc48eSAndrew Thompson #define	USB_DO_REQUEST		_IOWR('U', 111, struct usb_ctl_request)
285760bc48eSAndrew Thompson #define	USB_GET_DEVICEINFO	_IOR ('U', 112, struct usb_device_info)
28602ac6454SAndrew Thompson #define	USB_SET_RX_SHORT_XFER	_IOW ('U', 113, int)
28702ac6454SAndrew Thompson #define	USB_SET_RX_TIMEOUT	_IOW ('U', 114, int)
28802ac6454SAndrew Thompson #define	USB_GET_RX_FRAME_SIZE	_IOR ('U', 115, int)
28902ac6454SAndrew Thompson #define	USB_GET_RX_BUFFER_SIZE	_IOR ('U', 117, int)
29002ac6454SAndrew Thompson #define	USB_SET_RX_BUFFER_SIZE	_IOW ('U', 118, int)
29102ac6454SAndrew Thompson #define	USB_SET_RX_STALL_FLAG	_IOW ('U', 119, int)
29202ac6454SAndrew Thompson #define	USB_SET_TX_STALL_FLAG	_IOW ('U', 120, int)
293760bc48eSAndrew Thompson #define	USB_GET_IFACE_DRIVER	_IOWR('U', 121, struct usb_gen_descriptor)
29402ac6454SAndrew Thompson #define	USB_CLAIM_INTERFACE	_IOW ('U', 122, int)
29502ac6454SAndrew Thompson #define	USB_RELEASE_INTERFACE	_IOW ('U', 123, int)
29602ac6454SAndrew Thompson #define	USB_IFACE_DRIVER_ACTIVE	_IOW ('U', 124, int)
29702ac6454SAndrew Thompson #define	USB_IFACE_DRIVER_DETACH	_IOW ('U', 125, int)
29802ac6454SAndrew Thompson #define	USB_GET_PLUGTIME	_IOR ('U', 126, uint32_t)
299760bc48eSAndrew Thompson #define	USB_READ_DIR		_IOW ('U', 127, struct usb_read_dir)
300c77a24c2SHans Petter Selasky /* 128 - 133 unused */
301c77a24c2SHans Petter Selasky #define	USB_GET_DEV_PORT_PATH	_IOR ('U', 134, struct usb_device_port_path)
302aafcb732SHans Petter Selasky #define	USB_GET_POWER_USAGE	_IOR ('U', 135, int)
30302ac6454SAndrew Thompson #define	USB_SET_TX_FORCE_SHORT	_IOW ('U', 136, int)
30402ac6454SAndrew Thompson #define	USB_SET_TX_TIMEOUT	_IOW ('U', 137, int)
30502ac6454SAndrew Thompson #define	USB_GET_TX_FRAME_SIZE	_IOR ('U', 138, int)
30602ac6454SAndrew Thompson #define	USB_GET_TX_BUFFER_SIZE	_IOR ('U', 139, int)
30702ac6454SAndrew Thompson #define	USB_SET_TX_BUFFER_SIZE	_IOW ('U', 140, int)
308760bc48eSAndrew Thompson #define	USB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb_interface_descriptor)
309760bc48eSAndrew Thompson #define	USB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb_endpoint_descriptor)
31002ac6454SAndrew Thompson #define	USB_SET_PORT_ENABLE	_IOW ('U', 143, int)
31102ac6454SAndrew Thompson #define	USB_SET_PORT_DISABLE	_IOW ('U', 144, int)
31202ac6454SAndrew Thompson #define	USB_SET_POWER_MODE	_IOW ('U', 145, int)
31302ac6454SAndrew Thompson #define	USB_GET_POWER_MODE	_IOR ('U', 146, int)
314f78fa6b6SAndrew Thompson #define	USB_SET_TEMPLATE	_IOW ('U', 147, int)
315f78fa6b6SAndrew Thompson #define	USB_GET_TEMPLATE	_IOR ('U', 148, int)
31602ac6454SAndrew Thompson 
31702ac6454SAndrew Thompson /* Modem device */
31802ac6454SAndrew Thompson #define	USB_GET_CM_OVER_DATA	_IOR ('U', 180, int)
31902ac6454SAndrew Thompson #define	USB_SET_CM_OVER_DATA	_IOW ('U', 181, int)
32002ac6454SAndrew Thompson 
32117c78d34SHans Petter Selasky /* GPIO control */
32217c78d34SHans Petter Selasky #define	USB_GET_GPIO		_IOR ('U', 182, int)
32317c78d34SHans Petter Selasky #define	USB_SET_GPIO		_IOW ('U', 183, int)
32417c78d34SHans Petter Selasky 
32502ac6454SAndrew Thompson /* USB file system interface */
326760bc48eSAndrew Thompson #define	USB_FS_START		_IOW ('U', 192, struct usb_fs_start)
327760bc48eSAndrew Thompson #define	USB_FS_STOP		_IOW ('U', 193, struct usb_fs_stop)
328760bc48eSAndrew Thompson #define	USB_FS_COMPLETE		_IOR ('U', 194, struct usb_fs_complete)
329760bc48eSAndrew Thompson #define	USB_FS_INIT		_IOW ('U', 195, struct usb_fs_init)
330760bc48eSAndrew Thompson #define	USB_FS_UNINIT		_IOW ('U', 196, struct usb_fs_uninit)
331760bc48eSAndrew Thompson #define	USB_FS_OPEN		_IOWR('U', 197, struct usb_fs_open)
332760bc48eSAndrew Thompson #define	USB_FS_CLOSE		_IOW ('U', 198, struct usb_fs_close)
333760bc48eSAndrew Thompson #define	USB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb_fs_clear_stall_sync)
334e9cec016SHans Petter Selasky #define	USB_FS_OPEN_STREAM	_IOWR('U', 200, struct usb_fs_open_stream)
33502ac6454SAndrew Thompson 
33602ac6454SAndrew Thompson /* USB quirk system interface */
337760bc48eSAndrew Thompson #define	USB_DEV_QUIRK_GET	_IOWR('Q', 0, struct usb_gen_quirk)
338760bc48eSAndrew Thompson #define	USB_QUIRK_NAME_GET	_IOWR('Q', 1, struct usb_gen_quirk)
339760bc48eSAndrew Thompson #define	USB_DEV_QUIRK_ADD	_IOW ('Q', 2, struct usb_gen_quirk)
340760bc48eSAndrew Thompson #define	USB_DEV_QUIRK_REMOVE	_IOW ('Q', 3, struct usb_gen_quirk)
34102ac6454SAndrew Thompson 
34275973647SAndrew Thompson #endif					/* _USB_IOCTL_H_ */
343