1f9f848faSopenharmony_ci/*-
2f9f848faSopenharmony_ci * SPDX-License-Identifier: BSD-2-Clause
3f9f848faSopenharmony_ci *
4f9f848faSopenharmony_ci * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
5f9f848faSopenharmony_ci * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
6f9f848faSopenharmony_ci * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
7f9f848faSopenharmony_ci *
8f9f848faSopenharmony_ci * Redistribution and use in source and binary forms, with or without
9f9f848faSopenharmony_ci * modification, are permitted provided that the following conditions
10f9f848faSopenharmony_ci * are met:
11f9f848faSopenharmony_ci * 1. Redistributions of source code must retain the above copyright
12f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer.
13f9f848faSopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
14f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
15f9f848faSopenharmony_ci *    documentation and/or other materials provided with the distribution.
16f9f848faSopenharmony_ci *
17f9f848faSopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18f9f848faSopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19f9f848faSopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20f9f848faSopenharmony_ci * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21f9f848faSopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22f9f848faSopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23f9f848faSopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24f9f848faSopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25f9f848faSopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26f9f848faSopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27f9f848faSopenharmony_ci * SUCH DAMAGE.
28f9f848faSopenharmony_ci */
29f9f848faSopenharmony_ci
30f9f848faSopenharmony_ci#ifndef _USB_IOCTL_H_
31f9f848faSopenharmony_ci#define	_USB_IOCTL_H_
32f9f848faSopenharmony_ci
33f9f848faSopenharmony_ci#include <linux/ioctl.h>
34f9f848faSopenharmony_ci
35f9f848faSopenharmony_ci#define	USB_DEVICE_NAME "usbctl"
36f9f848faSopenharmony_ci#define	USB_DEVICE_DIR "/dev/usb"
37f9f848faSopenharmony_ci#define	USB_GENERIC_NAME "ugen"
38f9f848faSopenharmony_ci#define	USB_TEMPLATE_SYSCTL "hw.usb.template"	/* integer type */
39f9f848faSopenharmony_ci
40f9f848faSopenharmony_ci/*
41f9f848faSopenharmony_ci * Align IOCTL structures to hide differences when running 32-bit
42f9f848faSopenharmony_ci * programs under 64-bit kernels:
43f9f848faSopenharmony_ci */
44f9f848faSopenharmony_ci#ifdef COMPAT_32BIT
45f9f848faSopenharmony_ci#define	USB_IOCTL_STRUCT_ALIGN(n) __aligned(n)
46f9f848faSopenharmony_ci#else
47f9f848faSopenharmony_ci#define	USB_IOCTL_STRUCT_ALIGN(n)
48f9f848faSopenharmony_ci#endif
49f9f848faSopenharmony_ci
50f9f848faSopenharmony_ci/* Definition of valid template sysctl values */
51f9f848faSopenharmony_ci
52f9f848faSopenharmony_cienum {
53f9f848faSopenharmony_ci	USB_TEMP_MSC,		/* USB Mass Storage */
54f9f848faSopenharmony_ci	USB_TEMP_CDCE,		/* USB CDC Ethernet */
55f9f848faSopenharmony_ci	USB_TEMP_MTP,		/* Message Transfer Protocol */
56f9f848faSopenharmony_ci	USB_TEMP_MODEM,		/* USB CDC Modem */
57f9f848faSopenharmony_ci	USB_TEMP_AUDIO,		/* USB Audio */
58f9f848faSopenharmony_ci	USB_TEMP_KBD,		/* USB Keyboard */
59f9f848faSopenharmony_ci	USB_TEMP_MOUSE,		/* USB Mouse */
60f9f848faSopenharmony_ci	USB_TEMP_PHONE,		/* USB Phone */
61f9f848faSopenharmony_ci	USB_TEMP_SERIALNET,	/* USB CDC Ethernet and Modem */
62f9f848faSopenharmony_ci	USB_TEMP_MIDI,		/* USB MIDI */
63f9f848faSopenharmony_ci	USB_TEMP_MULTI,		/* USB Ethernet, serial, and storage */
64f9f848faSopenharmony_ci	USB_TEMP_CDCEEM,	/* USB Ethernet Emulation Model */
65f9f848faSopenharmony_ci	USB_TEMP_MAX,
66f9f848faSopenharmony_ci};
67f9f848faSopenharmony_ci
68f9f848faSopenharmony_cistruct usb_read_dir {
69f9f848faSopenharmony_ci#ifdef COMPAT_32BIT
70f9f848faSopenharmony_ci	uint64_t urd_data;
71f9f848faSopenharmony_ci#else
72f9f848faSopenharmony_ci	void   *urd_data;
73f9f848faSopenharmony_ci#endif
74f9f848faSopenharmony_ci	uint32_t urd_startentry;
75f9f848faSopenharmony_ci	uint32_t urd_maxlen;
76f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(8);
77f9f848faSopenharmony_ci
78f9f848faSopenharmony_cistruct usb_ctl_request {
79f9f848faSopenharmony_ci#ifdef COMPAT_32BIT
80f9f848faSopenharmony_ci	uint64_t ucr_data;
81f9f848faSopenharmony_ci#else
82f9f848faSopenharmony_ci	void   *ucr_data;
83f9f848faSopenharmony_ci#endif
84f9f848faSopenharmony_ci	uint16_t ucr_flags;
85f9f848faSopenharmony_ci	uint16_t ucr_actlen;		/* actual length transferred */
86f9f848faSopenharmony_ci	uint8_t	ucr_addr;		/* zero - currently not used */
87f9f848faSopenharmony_ci	struct usb_device_request ucr_request;
88f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(8);
89f9f848faSopenharmony_ci
90f9f848faSopenharmony_cistruct usb_alt_interface {
91f9f848faSopenharmony_ci	uint8_t	uai_interface_index;
92f9f848faSopenharmony_ci	uint8_t	uai_alt_index;
93f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
94f9f848faSopenharmony_ci
95f9f848faSopenharmony_cistruct usb_gen_descriptor {
96f9f848faSopenharmony_ci#ifdef COMPAT_32BIT
97f9f848faSopenharmony_ci	uint64_t ugd_data;
98f9f848faSopenharmony_ci#else
99f9f848faSopenharmony_ci	void   *ugd_data;
100f9f848faSopenharmony_ci#endif
101f9f848faSopenharmony_ci	uint16_t ugd_lang_id;
102f9f848faSopenharmony_ci	uint16_t ugd_maxlen;
103f9f848faSopenharmony_ci	uint16_t ugd_actlen;
104f9f848faSopenharmony_ci	uint16_t ugd_offset;
105f9f848faSopenharmony_ci	uint8_t	ugd_config_index;
106f9f848faSopenharmony_ci	uint8_t	ugd_string_index;
107f9f848faSopenharmony_ci	uint8_t	ugd_iface_index;
108f9f848faSopenharmony_ci	uint8_t	ugd_altif_index;
109f9f848faSopenharmony_ci	uint8_t	ugd_endpt_index;
110f9f848faSopenharmony_ci	uint8_t	ugd_report_type;
111f9f848faSopenharmony_ci	uint8_t	reserved[8];
112f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(8);
113f9f848faSopenharmony_ci
114f9f848faSopenharmony_cistruct usb_device_info {
115f9f848faSopenharmony_ci	uint16_t udi_productNo;
116f9f848faSopenharmony_ci	uint16_t udi_vendorNo;
117f9f848faSopenharmony_ci	uint16_t udi_releaseNo;
118f9f848faSopenharmony_ci	uint16_t udi_power;		/* power consumption in mA, 0 if
119f9f848faSopenharmony_ci					 * selfpowered */
120f9f848faSopenharmony_ci	uint8_t	udi_bus;
121f9f848faSopenharmony_ci	uint8_t	udi_addr;		/* device address */
122f9f848faSopenharmony_ci	uint8_t	udi_index;		/* device index */
123f9f848faSopenharmony_ci	uint8_t	udi_class;
124f9f848faSopenharmony_ci	uint8_t	udi_subclass;
125f9f848faSopenharmony_ci	uint8_t	udi_protocol;
126f9f848faSopenharmony_ci	uint8_t	udi_config_no;		/* current config number */
127f9f848faSopenharmony_ci	uint8_t	udi_config_index;	/* current config index */
128f9f848faSopenharmony_ci	uint8_t	udi_speed;		/* see "USB_SPEED_XXX" */
129f9f848faSopenharmony_ci	uint8_t	udi_mode;		/* see "USB_MODE_XXX" */
130f9f848faSopenharmony_ci	uint8_t	udi_nports;
131f9f848faSopenharmony_ci	uint8_t	udi_hubaddr;		/* parent HUB address */
132f9f848faSopenharmony_ci	uint8_t	udi_hubindex;		/* parent HUB device index */
133f9f848faSopenharmony_ci	uint8_t	udi_hubport;		/* parent HUB port */
134f9f848faSopenharmony_ci	uint8_t	udi_power_mode;		/* see "USB_POWER_MODE_XXX" */
135f9f848faSopenharmony_ci	uint8_t	udi_suspended;		/* set if device is suspended */
136f9f848faSopenharmony_ci	uint8_t	udi_reserved[16];	/* leave space for the future */
137f9f848faSopenharmony_ci	char	udi_product[128];
138f9f848faSopenharmony_ci	char	udi_vendor[128];
139f9f848faSopenharmony_ci	char	udi_serial[64];
140f9f848faSopenharmony_ci	char	udi_release[8];
141f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(2);
142f9f848faSopenharmony_ci
143f9f848faSopenharmony_ci#define	USB_DEVICE_PORT_PATH_MAX 32
144f9f848faSopenharmony_ci
145f9f848faSopenharmony_cistruct usb_device_port_path {
146f9f848faSopenharmony_ci	uint8_t udp_bus;		/* which bus we are on */
147f9f848faSopenharmony_ci	uint8_t udp_index;		/* which device index */
148f9f848faSopenharmony_ci	uint8_t udp_port_level;		/* how many levels: 0, 1, 2 ... */
149f9f848faSopenharmony_ci	uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX];
150f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
151f9f848faSopenharmony_ci
152f9f848faSopenharmony_cistruct usb_device_stats {
153f9f848faSopenharmony_ci	uint32_t uds_requests_ok[4];	/* Indexed by transfer type UE_XXX */
154f9f848faSopenharmony_ci	uint32_t uds_requests_fail[4];	/* Indexed by transfer type UE_XXX */
155f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(4);
156f9f848faSopenharmony_ci
157f9f848faSopenharmony_cistruct usb_fs_start {
158f9f848faSopenharmony_ci	uint8_t	ep_index;
159f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
160f9f848faSopenharmony_ci
161f9f848faSopenharmony_cistruct usb_fs_stop {
162f9f848faSopenharmony_ci	uint8_t	ep_index;
163f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
164f9f848faSopenharmony_ci
165f9f848faSopenharmony_cistruct usb_fs_complete {
166f9f848faSopenharmony_ci	uint8_t	ep_index;
167f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
168f9f848faSopenharmony_ci
169f9f848faSopenharmony_ci/* This structure is used for all endpoint types */
170f9f848faSopenharmony_cistruct usb_fs_endpoint {
171f9f848faSopenharmony_ci	/*
172f9f848faSopenharmony_ci	 * NOTE: isochronous USB transfer only use one buffer, but can have
173f9f848faSopenharmony_ci	 * multiple frame lengths !
174f9f848faSopenharmony_ci	 */
175f9f848faSopenharmony_ci#ifdef COMPAT_32BIT
176f9f848faSopenharmony_ci	uint64_t ppBuffer;
177f9f848faSopenharmony_ci	uint64_t pLength;
178f9f848faSopenharmony_ci#else
179f9f848faSopenharmony_ci	void  **ppBuffer;		/* pointer to userland buffers */
180f9f848faSopenharmony_ci	uint32_t *pLength;		/* pointer to frame lengths, updated
181f9f848faSopenharmony_ci					 * to actual length */
182f9f848faSopenharmony_ci#endif
183f9f848faSopenharmony_ci	uint32_t nFrames;		/* number of frames */
184f9f848faSopenharmony_ci	uint32_t aFrames;		/* actual number of frames */
185f9f848faSopenharmony_ci	uint16_t flags;
186f9f848faSopenharmony_ci	/* a single short frame will terminate */
187f9f848faSopenharmony_ci#define	USB_FS_FLAG_SINGLE_SHORT_OK 0x0001
188f9f848faSopenharmony_ci	/* multiple short frames are allowed */
189f9f848faSopenharmony_ci#define	USB_FS_FLAG_MULTI_SHORT_OK 0x0002
190f9f848faSopenharmony_ci	/* all frame(s) transmitted are short terminated */
191f9f848faSopenharmony_ci#define	USB_FS_FLAG_FORCE_SHORT 0x0004
192f9f848faSopenharmony_ci	/* will do a clear-stall before xfer */
193f9f848faSopenharmony_ci#define	USB_FS_FLAG_CLEAR_STALL 0x0008
194f9f848faSopenharmony_ci	uint16_t timeout;		/* in milliseconds */
195f9f848faSopenharmony_ci	/* isocronous completion time in milliseconds - used for echo cancel */
196f9f848faSopenharmony_ci	uint16_t isoc_time_complete;
197f9f848faSopenharmony_ci	/* timeout value for no timeout */
198f9f848faSopenharmony_ci#define	USB_FS_TIMEOUT_NONE 0
199f9f848faSopenharmony_ci	int	status;			/* see USB_ERR_XXX */
200f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(8);
201f9f848faSopenharmony_ci
202f9f848faSopenharmony_cistruct usb_fs_init {
203f9f848faSopenharmony_ci	/* userland pointer to endpoints structure */
204f9f848faSopenharmony_ci#ifdef COMPAT_32BIT
205f9f848faSopenharmony_ci	uint64_t pEndpoints;
206f9f848faSopenharmony_ci#else
207f9f848faSopenharmony_ci	struct usb_fs_endpoint *pEndpoints;
208f9f848faSopenharmony_ci#endif
209f9f848faSopenharmony_ci	/* maximum number of endpoints */
210f9f848faSopenharmony_ci	uint8_t	ep_index_max;
211f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(8);
212f9f848faSopenharmony_ci
213f9f848faSopenharmony_cistruct usb_fs_uninit {
214f9f848faSopenharmony_ci	uint8_t	dummy;			/* zero */
215f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
216f9f848faSopenharmony_ci
217f9f848faSopenharmony_cistruct usb_fs_open {
218f9f848faSopenharmony_ci#define	USB_FS_MAX_BUFSIZE (1 << 25)	/* 32 MBytes */
219f9f848faSopenharmony_ci	uint32_t max_bufsize;
220f9f848faSopenharmony_ci#define	USB_FS_MAX_FRAMES		(1U << 12)
221f9f848faSopenharmony_ci#define	USB_FS_MAX_FRAMES_PRE_SCALE	(1U << 31)	/* for ISOCHRONOUS transfers */
222f9f848faSopenharmony_ci	uint32_t max_frames;		/* read and write */
223f9f848faSopenharmony_ci	uint16_t max_packet_length;	/* read only */
224f9f848faSopenharmony_ci	uint8_t	dev_index;		/* currently unused */
225f9f848faSopenharmony_ci	uint8_t	ep_index;
226f9f848faSopenharmony_ci	uint8_t	ep_no;			/* bEndpointNumber */
227f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(4);
228f9f848faSopenharmony_ci
229f9f848faSopenharmony_cistruct usb_fs_open_stream {
230f9f848faSopenharmony_ci	struct usb_fs_open fs_open;
231f9f848faSopenharmony_ci	uint16_t stream_id;		/* stream ID */
232f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(4);
233f9f848faSopenharmony_ci
234f9f848faSopenharmony_cistruct usb_fs_close {
235f9f848faSopenharmony_ci	uint8_t	ep_index;
236f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
237f9f848faSopenharmony_ci
238f9f848faSopenharmony_cistruct usb_fs_clear_stall_sync {
239f9f848faSopenharmony_ci	uint8_t	ep_index;
240f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(1);
241f9f848faSopenharmony_ci
242f9f848faSopenharmony_cistruct usb_gen_quirk {
243f9f848faSopenharmony_ci	uint16_t index;			/* Quirk Index */
244f9f848faSopenharmony_ci	uint16_t vid;			/* Vendor ID */
245f9f848faSopenharmony_ci	uint16_t pid;			/* Product ID */
246f9f848faSopenharmony_ci	uint16_t bcdDeviceLow;		/* Low Device Revision */
247f9f848faSopenharmony_ci	uint16_t bcdDeviceHigh;		/* High Device Revision */
248f9f848faSopenharmony_ci	uint16_t reserved[2];
249f9f848faSopenharmony_ci	/*
250f9f848faSopenharmony_ci	 * String version of quirk including terminating zero. See
251f9f848faSopenharmony_ci	 * UQ_XXX in "usb_quirk.h".
252f9f848faSopenharmony_ci	 */
253f9f848faSopenharmony_ci	char	quirkname[64 - 14];
254f9f848faSopenharmony_ci} USB_IOCTL_STRUCT_ALIGN(2);
255f9f848faSopenharmony_ci
256f9f848faSopenharmony_ci/* USB controller */
257f9f848faSopenharmony_ci#define	USB_REQUEST		_IOWR('U', 1, struct usb_ctl_request)
258f9f848faSopenharmony_ci#define	USB_SETDEBUG		_IOW ('U', 2, int)
259f9f848faSopenharmony_ci#define	USB_DISCOVER		_IO  ('U', 3)
260f9f848faSopenharmony_ci#define	USB_DEVICEINFO		_IOWR('U', 4, struct usb_device_info)
261f9f848faSopenharmony_ci#define	USB_DEVICESTATS		_IOR ('U', 5, struct usb_device_stats)
262f9f848faSopenharmony_ci#define	USB_DEVICEENUMERATE	_IOW ('U', 6, int)
263f9f848faSopenharmony_ci
264f9f848faSopenharmony_ci/* Generic HID device. Numbers 26 and 30-39 are occupied by hidraw. */
265f9f848faSopenharmony_ci#define	USB_GET_REPORT_DESC	_IOWR('U', 21, struct usb_gen_descriptor)
266f9f848faSopenharmony_ci#define	USB_SET_IMMED		_IOW ('U', 22, int)
267f9f848faSopenharmony_ci#define	USB_GET_REPORT		_IOWR('U', 23, struct usb_gen_descriptor)
268f9f848faSopenharmony_ci#define	USB_SET_REPORT		_IOW ('U', 24, struct usb_gen_descriptor)
269f9f848faSopenharmony_ci#define	USB_GET_REPORT_ID	_IOR ('U', 25, int)
270f9f848faSopenharmony_ci
271f9f848faSopenharmony_ci/* Generic USB device */
272f9f848faSopenharmony_ci#define	USB_GET_CONFIG		_IOR ('U', 100, int)
273f9f848faSopenharmony_ci#define	USB_SET_CONFIG		_IOW ('U', 101, int)
274f9f848faSopenharmony_ci#define	USB_GET_ALTINTERFACE	_IOWR('U', 102, struct usb_alt_interface)
275f9f848faSopenharmony_ci#define	USB_SET_ALTINTERFACE	_IOWR('U', 103, struct usb_alt_interface)
276f9f848faSopenharmony_ci#define	USB_GET_DEVICE_DESC	_IOR ('U', 105, struct usb_device_descriptor)
277f9f848faSopenharmony_ci#define	USB_GET_CONFIG_DESC	_IOR ('U', 106, struct usb_config_descriptor)
278f9f848faSopenharmony_ci#define	USB_GET_RX_INTERFACE_DESC _IOR ('U', 107, struct usb_interface_descriptor)
279f9f848faSopenharmony_ci#define	USB_GET_RX_ENDPOINT_DESC _IOR ('U', 108, struct usb_endpoint_descriptor)
280f9f848faSopenharmony_ci#define	USB_GET_FULL_DESC	_IOWR('U', 109, struct usb_gen_descriptor)
281f9f848faSopenharmony_ci#define	USB_GET_STRING_DESC	_IOWR('U', 110, struct usb_gen_descriptor)
282f9f848faSopenharmony_ci#define	USB_DO_REQUEST		_IOWR('U', 111, struct usb_ctl_request)
283f9f848faSopenharmony_ci#define	USB_GET_DEVICEINFO	_IOR ('U', 112, struct usb_device_info)
284f9f848faSopenharmony_ci#define	USB_SET_RX_SHORT_XFER	_IOW ('U', 113, int)
285f9f848faSopenharmony_ci#define	USB_SET_RX_TIMEOUT	_IOW ('U', 114, int)
286f9f848faSopenharmony_ci#define	USB_GET_RX_FRAME_SIZE	_IOR ('U', 115, int)
287f9f848faSopenharmony_ci#define	USB_GET_RX_BUFFER_SIZE	_IOR ('U', 117, int)
288f9f848faSopenharmony_ci#define	USB_SET_RX_BUFFER_SIZE	_IOW ('U', 118, int)
289f9f848faSopenharmony_ci#define	USB_SET_RX_STALL_FLAG	_IOW ('U', 119, int)
290f9f848faSopenharmony_ci#define	USB_SET_TX_STALL_FLAG	_IOW ('U', 120, int)
291f9f848faSopenharmony_ci#define	USB_GET_IFACE_DRIVER	_IOWR('U', 121, struct usb_gen_descriptor)
292f9f848faSopenharmony_ci#define	USB_CLAIM_INTERFACE	_IOW ('U', 122, int)
293f9f848faSopenharmony_ci#define	USB_RELEASE_INTERFACE	_IOW ('U', 123, int)
294f9f848faSopenharmony_ci#define	USB_IFACE_DRIVER_ACTIVE	_IOW ('U', 124, int)
295f9f848faSopenharmony_ci#define	USB_IFACE_DRIVER_DETACH	_IOW ('U', 125, int)
296f9f848faSopenharmony_ci#define	USB_GET_PLUGTIME	_IOR ('U', 126, uint32_t)
297f9f848faSopenharmony_ci#define	USB_READ_DIR		_IOW ('U', 127, struct usb_read_dir)
298f9f848faSopenharmony_ci/* 128 - 133 unused */
299f9f848faSopenharmony_ci#define	USB_GET_DEV_PORT_PATH	_IOR ('U', 134, struct usb_device_port_path)
300f9f848faSopenharmony_ci#define	USB_GET_POWER_USAGE	_IOR ('U', 135, int)
301f9f848faSopenharmony_ci#define	USB_SET_TX_FORCE_SHORT	_IOW ('U', 136, int)
302f9f848faSopenharmony_ci#define	USB_SET_TX_TIMEOUT	_IOW ('U', 137, int)
303f9f848faSopenharmony_ci#define	USB_GET_TX_FRAME_SIZE	_IOR ('U', 138, int)
304f9f848faSopenharmony_ci#define	USB_GET_TX_BUFFER_SIZE	_IOR ('U', 139, int)
305f9f848faSopenharmony_ci#define	USB_SET_TX_BUFFER_SIZE	_IOW ('U', 140, int)
306f9f848faSopenharmony_ci#define	USB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb_interface_descriptor)
307f9f848faSopenharmony_ci#define	USB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb_endpoint_descriptor)
308f9f848faSopenharmony_ci#define	USB_SET_PORT_ENABLE	_IOW ('U', 143, int)
309f9f848faSopenharmony_ci#define	USB_SET_PORT_DISABLE	_IOW ('U', 144, int)
310f9f848faSopenharmony_ci#define	USB_SET_POWER_MODE	_IOW ('U', 145, int)
311f9f848faSopenharmony_ci#define	USB_GET_POWER_MODE	_IOR ('U', 146, int)
312f9f848faSopenharmony_ci#define	USB_SET_TEMPLATE	_IOW ('U', 147, int)
313f9f848faSopenharmony_ci#define	USB_GET_TEMPLATE	_IOR ('U', 148, int)
314f9f848faSopenharmony_ci
315f9f848faSopenharmony_ci/* Modem device */
316f9f848faSopenharmony_ci#define	USB_GET_CM_OVER_DATA	_IOR ('U', 180, int)
317f9f848faSopenharmony_ci#define	USB_SET_CM_OVER_DATA	_IOW ('U', 181, int)
318f9f848faSopenharmony_ci
319f9f848faSopenharmony_ci/* GPIO control */
320f9f848faSopenharmony_ci#define	USB_GET_GPIO		_IOR ('U', 182, int)
321f9f848faSopenharmony_ci#define	USB_SET_GPIO		_IOW ('U', 183, int)
322f9f848faSopenharmony_ci
323f9f848faSopenharmony_ci/* USB file system interface */
324f9f848faSopenharmony_ci#define	USB_FS_START		_IOW ('U', 192, struct usb_fs_start)
325f9f848faSopenharmony_ci#define	USB_FS_STOP		_IOW ('U', 193, struct usb_fs_stop)
326f9f848faSopenharmony_ci#define	USB_FS_COMPLETE		_IOR ('U', 194, struct usb_fs_complete)
327f9f848faSopenharmony_ci#define	USB_FS_INIT		_IOW ('U', 195, struct usb_fs_init)
328f9f848faSopenharmony_ci#define	USB_FS_UNINIT		_IOW ('U', 196, struct usb_fs_uninit)
329f9f848faSopenharmony_ci#define	USB_FS_OPEN		_IOWR('U', 197, struct usb_fs_open)
330f9f848faSopenharmony_ci#define	USB_FS_CLOSE		_IOW ('U', 198, struct usb_fs_close)
331f9f848faSopenharmony_ci#define	USB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb_fs_clear_stall_sync)
332f9f848faSopenharmony_ci#define	USB_FS_OPEN_STREAM	_IOWR('U', 200, struct usb_fs_open_stream)
333f9f848faSopenharmony_ci
334f9f848faSopenharmony_ci/* USB quirk system interface */
335f9f848faSopenharmony_ci#define	USB_DEV_QUIRK_GET	_IOWR('Q', 0, struct usb_gen_quirk)
336f9f848faSopenharmony_ci#define	USB_QUIRK_NAME_GET	_IOWR('Q', 1, struct usb_gen_quirk)
337f9f848faSopenharmony_ci#define	USB_DEV_QUIRK_ADD	_IOW ('Q', 2, struct usb_gen_quirk)
338f9f848faSopenharmony_ci#define	USB_DEV_QUIRK_REMOVE	_IOW ('Q', 3, struct usb_gen_quirk)
339f9f848faSopenharmony_ci
340f9f848faSopenharmony_ci#endif					/* _USB_IOCTL_H_ */
341