Home | History | Annotate | Line # | Download | only in usb
usb.h revision 1.111.2.4
      1 /*	$NetBSD: usb.h,v 1.111.2.4 2014/12/03 14:18:07 skrll Exp $	*/
      2 /*	$FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $	*/
      3 
      4 /*
      5  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      6  * All rights reserved.
      7  *
      8  * This code is derived from software contributed to The NetBSD Foundation
      9  * by Lennart Augustsson (lennart (at) augustsson.net) at
     10  * Carlstedt Research & Technology.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     31  * POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 
     35 #ifndef _USB_H_
     36 #define _USB_H_
     37 
     38 #include <sys/types.h>
     39 #include <sys/time.h>
     40 
     41 #include <sys/ioctl.h>
     42 
     43 #if defined(_KERNEL)
     44 
     45 #include <sys/device.h>
     46 
     47 #endif
     48 
     49 #ifdef USB_DEBUG
     50 #define Static
     51 #else
     52 #define Static static
     53 #endif
     54 
     55 #define USB_STACK_VERSION 2
     56 
     57 #define USB_MAX_DEVICES 128
     58 #define USB_MIN_DEVICES 2               /* unused + root HUB */
     59 #define USB_START_ADDR 0
     60 
     61 #define USB_CONTROL_ENDPOINT 0
     62 #define USB_MAX_ENDPOINTS 16
     63 
     64 #define USB_FRAMES_PER_SECOND 1000
     65 #define USB_UFRAMES_PER_FRAME 8
     66 
     67 /*
     68  * The USB records contain some unaligned little-endian word
     69  * components.  The U[SG]ETW macros take care of both the alignment
     70  * and endian problem and should always be used to access non-byte
     71  * values.
     72  */
     73 typedef uint8_t uByte;
     74 typedef uint8_t uWord[2];
     75 typedef uint8_t uDWord[4];
     76 
     77 #define USETW2(w,h,l) ((w)[0] = (uint8_t)(l), (w)[1] = (uint8_t)(h))
     78 
     79 #define UGETW(w) ((w)[0] | ((w)[1] << 8))
     80 #define USETW(w,v) ((w)[0] = (uint8_t)(v), (w)[1] = (uint8_t)((v) >> 8))
     81 #define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24))
     82 #define USETDW(w,v) ((w)[0] = (uint8_t)(v), \
     83 		     (w)[1] = (uint8_t)((v) >> 8), \
     84 		     (w)[2] = (uint8_t)((v) >> 16), \
     85 		     (w)[3] = (uint8_t)((v) >> 24))
     86 #define UPACKED __packed
     87 
     88 typedef struct {
     89 	uByte		bmRequestType;
     90 	uByte		bRequest;
     91 	uWord		wValue;
     92 	uWord		wIndex;
     93 	uWord		wLength;
     94 } UPACKED usb_device_request_t;
     95 
     96 #define UT_GET_DIR(a) ((a) & 0x80)
     97 #define UT_WRITE		0x00
     98 #define UT_READ			0x80
     99 
    100 #define UT_GET_TYPE(a) ((a) & 0x60)
    101 #define UT_STANDARD		0x00
    102 #define UT_CLASS		0x20
    103 #define UT_VENDOR		0x40
    104 
    105 #define UT_GET_RECIPIENT(a) ((a) & 0x1f)
    106 #define UT_DEVICE		0x00
    107 #define UT_INTERFACE		0x01
    108 #define UT_ENDPOINT		0x02
    109 #define UT_OTHER		0x03
    110 
    111 #define UT_READ_DEVICE		(UT_READ  | UT_STANDARD | UT_DEVICE)
    112 #define UT_READ_INTERFACE	(UT_READ  | UT_STANDARD | UT_INTERFACE)
    113 #define UT_READ_ENDPOINT	(UT_READ  | UT_STANDARD | UT_ENDPOINT)
    114 #define UT_WRITE_DEVICE		(UT_WRITE | UT_STANDARD | UT_DEVICE)
    115 #define UT_WRITE_INTERFACE	(UT_WRITE | UT_STANDARD | UT_INTERFACE)
    116 #define UT_WRITE_ENDPOINT	(UT_WRITE | UT_STANDARD | UT_ENDPOINT)
    117 #define UT_READ_CLASS_DEVICE	(UT_READ  | UT_CLASS | UT_DEVICE)
    118 #define UT_READ_CLASS_INTERFACE	(UT_READ  | UT_CLASS | UT_INTERFACE)
    119 #define UT_READ_CLASS_OTHER	(UT_READ  | UT_CLASS | UT_OTHER)
    120 #define UT_READ_CLASS_ENDPOINT	(UT_READ  | UT_CLASS | UT_ENDPOINT)
    121 #define UT_WRITE_CLASS_DEVICE	(UT_WRITE | UT_CLASS | UT_DEVICE)
    122 #define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE)
    123 #define UT_WRITE_CLASS_OTHER	(UT_WRITE | UT_CLASS | UT_OTHER)
    124 #define UT_WRITE_CLASS_ENDPOINT	(UT_WRITE | UT_CLASS | UT_ENDPOINT)
    125 #define UT_READ_VENDOR_DEVICE	(UT_READ  | UT_VENDOR | UT_DEVICE)
    126 #define UT_READ_VENDOR_INTERFACE (UT_READ  | UT_VENDOR | UT_INTERFACE)
    127 #define UT_READ_VENDOR_OTHER	(UT_READ  | UT_VENDOR | UT_OTHER)
    128 #define UT_READ_VENDOR_ENDPOINT	(UT_READ  | UT_VENDOR | UT_ENDPOINT)
    129 #define UT_WRITE_VENDOR_DEVICE	(UT_WRITE | UT_VENDOR | UT_DEVICE)
    130 #define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE)
    131 #define UT_WRITE_VENDOR_OTHER	(UT_WRITE | UT_VENDOR | UT_OTHER)
    132 #define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT)
    133 
    134 /* Standard Requests Codes from the USB 2.0 spec, table 9-4 */
    135 #define UR_GET_STATUS		0x00
    136 #define UR_CLEAR_FEATURE	0x01
    137 #define UR_SET_FEATURE		0x03
    138 #define UR_SET_ADDRESS		0x05
    139 #define UR_GET_DESCRIPTOR	0x06
    140 #define  UDESC_DEVICE		0x01
    141 #define  UDESC_CONFIG		0x02
    142 #define  UDESC_STRING		0x03
    143 #define  UDESC_INTERFACE	0x04
    144 #define  UDESC_ENDPOINT		0x05
    145 #define  UDESC_DEVICE_QUALIFIER	0x06
    146 #define  UDESC_OTHER_SPEED_CONFIGURATION 0x07
    147 #define  UDESC_INTERFACE_POWER	0x08
    148 #define  UDESC_OTG		0x09
    149 #define  UDESC_DEBUG		0x0a
    150 #define  UDESC_INTERFACE_ASSOC	0x0b
    151 #define  UDESC_BOS		0x0f
    152 #define  UDESC_DEVICE_CAPABILITY 0x10
    153 #define  UDESC_CS_DEVICE	0x21	/* class specific */
    154 #define  UDESC_CS_CONFIG	0x22
    155 #define  UDESC_CS_STRING	0x23
    156 #define  UDESC_CS_INTERFACE	0x24
    157 #define  UDESC_CS_ENDPOINT	0x25
    158 #define  UDESC_HUB		0x29
    159 #define  UDESC_SS_HUB		0x2a	/* super speed */
    160 #define  UDESC_ENDPOINT_SS_COMP 0x30	/* super speed */
    161 #define  UDESC_ENDPOINT_ISOCH_SSP_COMP	0x31
    162 #define UR_SET_DESCRIPTOR	0x07
    163 #define UR_GET_CONFIG		0x08
    164 #define UR_SET_CONFIG		0x09
    165 #define UR_GET_INTERFACE	0x0a
    166 #define UR_SET_INTERFACE	0x0b
    167 #define UR_SYNCH_FRAME		0x0c
    168 #define UR_SET_ENCRYPTION	0x0d
    169 #define UR_GET_ENCRYPTION	0x0e
    170 #define UR_SET_HANDSHAKE	0x0f
    171 #define UR_GET_HANDSHAKE	0x10
    172 #define UR_SET_CONNECTION	0x11
    173 #define UR_SET_SECURITY_DATA	0x12
    174 #define UR_GET_SECURITY_DATA	0x13
    175 #define UR_SET_WUSB_DATA	0x14
    176 #define UR_LOOPBACK_DATA_WRITE	0x15
    177 #define UR_LOOPBACK_DATA_READ	0x16
    178 #define UR_SET_INTERFACE_DS	0x17
    179 #define UR_SET_SEL		0x30
    180 #define UR_SET_ISOCH_DELAY	0x31
    181 
    182 /*
    183  * Feature selectors. USB 2.0 spec, table 9-6 and OTG and EH suppliment,
    184  * table 6-2
    185  */
    186 #define UF_ENDPOINT_HALT	0
    187 #define UF_INTERFACE_FUNCTION_SUSPEND	0
    188 #define UF_DEVICE_REMOTE_WAKEUP	1
    189 #define UF_TEST_MODE		2
    190 #define UF_DEVICE_B_HNP_ENABLE	3
    191 #define UF_DEVICE_A_HNP_SUPPORT	4
    192 #define UF_DEVICE_A_ALT_HNP_SUPPORT 5
    193 #define UF_DEVICE_WUSB_DEVICE	6
    194 #define UF_U1_ENABLE		0x30
    195 #define UF_U2_ENABLE		0x31
    196 #define UF_LTM_ENABLE		0x32
    197 
    198 #define USB_MAX_IPACKET		8 /* maximum size of the initial packet */
    199 
    200 #define USB_2_MAX_CTRL_PACKET	64
    201 #define USB_2_MAX_BULK_PACKET	512
    202 
    203 #define USB_3_MAX_CTRL_PACKET	512
    204 
    205 typedef struct {
    206 	uByte		bLength;
    207 	uByte		bDescriptorType;
    208 } UPACKED usb_descriptor_t;
    209 
    210 typedef struct {
    211 	uByte		bLength;
    212 	uByte		bDescriptorType;
    213 	uWord		bcdUSB;
    214 #define UD_USB_2_0		0x0200
    215 #define UD_USB_3_0		0x0300
    216 #define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0)
    217 #define UD_IS_USB3(d) (UGETW((d)->bcdUSB) >= UD_USB_3_0)
    218 	uByte		bDeviceClass;
    219 	uByte		bDeviceSubClass;
    220 	uByte		bDeviceProtocol;
    221 	uByte		bMaxPacketSize;
    222 	/* The fields below are not part of the initial descriptor. */
    223 	uWord		idVendor;
    224 	uWord		idProduct;
    225 	uWord		bcdDevice;
    226 	uByte		iManufacturer;
    227 	uByte		iProduct;
    228 	uByte		iSerialNumber;
    229 	uByte		bNumConfigurations;
    230 } UPACKED usb_device_descriptor_t;
    231 #define USB_DEVICE_DESCRIPTOR_SIZE 18
    232 
    233 typedef struct {
    234 	uByte		bLength;
    235 	uByte		bDescriptorType;
    236 	uWord		wTotalLength;
    237 	uByte		bNumInterface;
    238 	uByte		bConfigurationValue;
    239 	uByte		iConfiguration;
    240 	uByte		bmAttributes;
    241 #define UC_ATTR_MBO		0x80
    242 #define UC_SELF_POWERED		0x40
    243 #define UC_REMOTE_WAKEUP	0x20
    244 	uByte		bMaxPower; /* max current in 2 mA units */
    245 #define UC_POWER_FACTOR 2
    246 } UPACKED usb_config_descriptor_t;
    247 #define USB_CONFIG_DESCRIPTOR_SIZE 9
    248 
    249 typedef struct {
    250 	uByte		bLength;
    251 	uByte		bDescriptorType;
    252 	uByte		bInterfaceNumber;
    253 	uByte		bAlternateSetting;
    254 	uByte		bNumEndpoints;
    255 	uByte		bInterfaceClass;
    256 	uByte		bInterfaceSubClass;
    257 	uByte		bInterfaceProtocol;
    258 	uByte		iInterface;
    259 } UPACKED usb_interface_descriptor_t;
    260 #define USB_INTERFACE_DESCRIPTOR_SIZE 9
    261 
    262 typedef struct {
    263 	uByte		bLength;
    264 	uByte		bDescriptorType;
    265 	uByte		bFirstInterface;
    266 	uByte		bInterfaceCount;
    267 	uByte		bFunctionClass;
    268 	uByte		bFunctionSubClass;
    269 	uByte		bFunctionProtocol;
    270 	uByte		iFunction;
    271 } UPACKED usb_interface_assoc_descriptor_t;
    272 #define USB_INTERFACE_ASSOC_DESCRIPTOR_SIZE 8
    273 
    274 typedef struct {
    275 	uByte		bLength;
    276 	uByte		bDescriptorType;
    277 	uByte		bEndpointAddress;
    278 #define UE_GET_DIR(a)	((a) & 0x80)
    279 #define UE_SET_DIR(a,d)	((a) | (((d)&1) << 7))
    280 #define UE_DIR_IN	0x80
    281 #define UE_DIR_OUT	0x00
    282 #define UE_ADDR		0x0f
    283 #define UE_GET_ADDR(a)	((a) & UE_ADDR)
    284 	uByte		bmAttributes;
    285 #define UE_XFERTYPE	0x03
    286 #define  UE_CONTROL	0x00
    287 #define  UE_ISOCHRONOUS	0x01
    288 #define  UE_BULK	0x02
    289 #define  UE_INTERRUPT	0x03
    290 #define UE_GET_XFERTYPE(a)	((a) & UE_XFERTYPE)
    291 #define UE_ISO_TYPE	0x0c
    292 #define  UE_ISO_ASYNC	0x04
    293 #define  UE_ISO_ADAPT	0x08
    294 #define  UE_ISO_SYNC	0x0c
    295 #define UE_GET_ISO_TYPE(a)	((a) & UE_ISO_TYPE)
    296 	uWord		wMaxPacketSize;
    297 #define UE_GET_TRANS(a)		(((a) >> 11) & 0x3)
    298 #define UE_GET_SIZE(a)		((a) & 0x7ff)
    299 	uByte		bInterval;
    300 } UPACKED usb_endpoint_descriptor_t;
    301 #define USB_ENDPOINT_DESCRIPTOR_SIZE 7
    302 
    303 typedef struct {
    304 	uByte		bLength;
    305 	uByte		bDescriptorType;
    306 	uByte		bMaxBurst;
    307 	uByte		bmAttributes;
    308 #define UE_SSC_MAXSTREAMS(x)	__SHIFTOUT(x, __BITS(4,0))	/* bulk */
    309 #define UE_SSC_MULT(x)		__SHIFTOUT(x, __BITS(1,0))	/* isoch */
    310 #define UE_SSC_SSP_ISO(x) 	__SHIFTOUT(x, __BIT(7))		/* isoch */
    311 	/* The fields below are only valid for periodic endpoints */
    312 	uWord		wBytesPerInterval;
    313 } UPACKED usb_endpoint_ss_comp_descriptor_t;
    314 #define USB_ENDPOINT_SS_COMP_DESCRIPTOR_SIZE 6
    315 
    316 typedef struct {
    317 	uByte		bLength;
    318 	uByte		bDescriptorType;
    319 	uWord		wTotalLength;
    320 	uByte		bNumDeviceCaps;
    321 } UPACKED usb_bos_descriptor_t;
    322 #define USB_BOS_DESCRIPTOR_SIZE 5
    323 
    324 typedef struct {
    325 	uByte		bLength;
    326 	uByte		bDescriptorType;
    327 	uByte		bDevCapabilityType;
    328 #define USB_DEVCAP_RESERVED			0x00
    329 #define USB_DEVCAP_WUSB				0x01
    330 #define USB_DEVCAP_USB2EXT			0x02
    331 #define USB_DEVCAP_SUPER_SPEED			0x03
    332 #define USB_DEVCAP_CONTAINER_ID			0x04
    333 #define USB_DEVCAP_PLATFORM			0x05
    334 #define USB_DEVCAP_POWER_DELIVERY_CAPABILITY	0x06
    335 #define USB_DEVCAP_BATTERY_INFO_CAPABILITY	0x07
    336 #define USB_DEVCAP_PD_CONSUMER_PORT_CAPABILITY	0x08
    337 #define USB_DEVCAP_PD_PROVIDER_PORT_CAPABILITY	0x09
    338 #define USB_DEVCAP_SUPERSPEED_PLUS		0x0a
    339 #define USB_DEVCAP_PRECISION_TIME_MEASUREMENT	0x0b
    340 #define USB_DEVCAP_WUSB_EXT			0x0c
    341 	/* data ... */
    342 } UPACKED usb_device_capability_descriptor_t;
    343 #define USB_DEVICE_CAPABILITY_DESCRIPTOR_SIZE 3 /* variable length */
    344 
    345 typedef struct {
    346 	uByte		bLength;
    347 	uByte		bDescriptorType;
    348 	uByte		bDevCapabilityType;
    349 	uDWord		bmAttributes;
    350 #define USB_DEVCAP_USB2EXT_LPM __BIT(1)
    351 } UPACKED usb_usb2ext_descriptor_t;
    352 #define USB_DEVCAP_USB2EXT_DESCRIPTOR_SIZE 7
    353 
    354 typedef struct {
    355 	uByte		bLength;
    356 	uByte		bDescriptorType;
    357 	uByte		bDevCapabilityType;
    358 	uByte		bmAttributes;
    359 #define USB_DEVCAP_SS_LTM __BIT(1)
    360 	uWord		wSpeedsSupported;
    361 #define USB_DEVCAP_SS_SPEED_SS __BIT(0)
    362 #define USB_DEVCAP_SS_SPEED_FS __BIT(1)
    363 #define USB_DEVCAP_SS_SPEED_HS __BIT(2)
    364 #define USB_DEVCAP_SS_SPEED_LS __BIT(3)
    365 	uByte		bFunctionalitySupport;
    366 	uByte		bU1DevExitLat;
    367 	uWord		wU2DevExitLat;
    368 } UPACKED usb_devcap_ss_descriptor_t;
    369 #define USB_DEVCAP_SS_DESCRIPTOR_SIZE 10
    370 
    371 typedef struct {
    372 	uByte		bLength;
    373 	uByte		bDescriptorType;
    374 	uByte		bDevCapabilityType;
    375 	uByte		bReserved;
    376 	uByte		ContainerID[16];
    377 } UPACKED usb_devcap_container_id_descriptor_t;
    378 #define USB_DEVCAP_CONTAINER_ID_DESCRIPTOR_SIZE 20
    379 
    380 typedef struct {
    381 	uByte		bLength;
    382 	uByte		bDescriptorType;
    383 	uByte		bDevCapabilityType;
    384 	uByte		bReserved;
    385 	uByte		PlatformCapabilityUUID[16];
    386 	uByte		CapabilityData[0];
    387 } UPACKED usb_devcap_platform_descriptor_t;
    388 #define USB_DEVCAP_PLATFORM_DESCRIPTOR_SIZE 20
    389 
    390 typedef struct {
    391 	uByte		bLength;
    392 	uByte		bDescriptorType;
    393 	uByte		bDevCapabilityType;
    394 	uByte		bReserved;
    395 	uDWord		bmAttributes;
    396 	uWord		wFunctionalitySupport;
    397 	uWord		wReserved;
    398 	uDWord		bmSublinkSpeedAttr[0];
    399 } UPACKED usb_devcap_ssp_descriptor_t;
    400 #define USB_DEVCAP_SSP_DESCRIPTOR_SIZE 12 /* variable length */
    401 
    402 typedef struct {
    403 	uByte		bLength;
    404 	uByte		bDescriptorType;
    405 	uWord		bString[126];
    406 } UPACKED usb_string_descriptor_t;
    407 #define USB_MAX_STRING_LEN 128
    408 #define USB_LANGUAGE_TABLE 0	/* # of the string language id table */
    409 #define USB_MAX_ENCODED_STRING_LEN (USB_MAX_STRING_LEN * 3) /* UTF8 */
    410 
    411 /* Hub specific request */
    412 #define UR_GET_BUS_STATE	0x02
    413 #define UR_CLEAR_TT_BUFFER	0x08
    414 #define UR_RESET_TT		0x09
    415 #define UR_GET_TT_STATE		0x0a
    416 #define UR_STOP_TT		0x0b
    417 #define UR_SET_HUB_DEPTH	0x0c
    418 #define UR_GET_PORT_ERR_COUNT	0x0d
    419 
    420 /*
    421  * Hub features from USB 2.0 spec, table 11-17 and updated by the
    422  * LPM ECN table 4-7.
    423  */
    424 #define UHF_C_HUB_LOCAL_POWER	0
    425 #define UHF_C_HUB_OVER_CURRENT	1
    426 #define UHF_PORT_CONNECTION	0
    427 #define UHF_PORT_ENABLE		1
    428 #define UHF_PORT_SUSPEND	2
    429 #define UHF_PORT_OVER_CURRENT	3
    430 #define UHF_PORT_RESET		4
    431 #define UHF_PORT_LINK_STATE	5
    432 #define UHF_PORT_POWER		8
    433 #define UHF_PORT_LOW_SPEED	9
    434 #define UHF_PORT_L1		10
    435 #define UHF_C_PORT_CONNECTION	16
    436 #define UHF_C_PORT_ENABLE	17
    437 #define UHF_C_PORT_SUSPEND	18
    438 #define UHF_C_PORT_OVER_CURRENT	19
    439 #define UHF_C_PORT_RESET	20
    440 #define UHF_PORT_TEST		21
    441 #define UHF_PORT_INDICATOR	22
    442 #define UHF_C_PORT_L1		23
    443 
    444 /* SS HUB specific features */
    445 #define UHF_PORT_U1_TIMEOUT	23
    446 #define UHF_PORT_U2_TIMEOUT	24
    447 #define UHF_C_PORT_LINK_STATE	25
    448 #define UHF_C_PORT_CONFIG_ERROR	26
    449 #define UHF_PORT_REMOTE_WAKE_MASK	27
    450 #define UHF_BH_PORT_RESET	28
    451 #define UHF_C_BH_PORT_RESET	29
    452 #define UHF_FORCE_LINKPM_ACCEPT	30
    453 
    454 typedef struct {
    455 	uByte		bDescLength;
    456 	uByte		bDescriptorType;
    457 	uByte		bNbrPorts;
    458 #define UHD_NPORTS_MAX		255
    459 	uWord		wHubCharacteristics;
    460 #define UHD_PWR			0x0003
    461 #define  UHD_PWR_GANGED		0x0000
    462 #define  UHD_PWR_INDIVIDUAL	0x0001
    463 #define  UHD_PWR_NO_SWITCH	0x0002
    464 #define UHD_COMPOUND		0x0004
    465 #define UHD_OC			0x0018
    466 #define  UHD_OC_GLOBAL		0x0000
    467 #define  UHD_OC_INDIVIDUAL	0x0008
    468 #define  UHD_OC_NONE		0x0010
    469 #define UHD_TT_THINK		0x0060
    470 #define  UHD_TT_THINK_8		0x0000
    471 #define  UHD_TT_THINK_16	0x0020
    472 #define  UHD_TT_THINK_24	0x0040
    473 #define  UHD_TT_THINK_32	0x0060
    474 #define UHD_PORT_IND		0x0080
    475 	uByte		bPwrOn2PwrGood;	/* delay in 2 ms units */
    476 #define UHD_PWRON_FACTOR 2
    477 	uByte		bHubContrCurrent;
    478 	uByte		DeviceRemovable[32]; /* max 255 ports */
    479 #define UHD_NOT_REMOV(desc, i) \
    480     (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1)
    481 	/* deprecated */ uByte		PortPowerCtrlMask[1];
    482 } UPACKED usb_hub_descriptor_t;
    483 #define USB_HUB_DESCRIPTOR_SIZE 9 /* includes deprecated PortPowerCtrlMask */
    484 
    485 typedef struct {
    486 	uByte		bLength;
    487 	uByte		bDescriptorType;
    488 	uByte		bNbrPorts;
    489 #define UHD_SS_NPORTS_MAX	15
    490 	uWord		wHubCharacteristics;
    491 	uByte		bPwrOn2PwrGood;	/* delay in 2 ms units */
    492 	uByte		bHubContrCurrent;
    493 	uByte		bHubHdrDecLat;
    494 	uWord		wHubDelay;	/* forward delay in nanosec */
    495 	uByte		DeviceRemovable[2]; /* max 15 ports */
    496 } UPACKED usb_hub_ss_descriptor_t;
    497 #define USB_HUB_SS_DESCRIPTOR_SIZE 12
    498 
    499 typedef struct {
    500 	uByte		bLength;
    501 	uByte		bDescriptorType;
    502 	uWord		bcdUSB;
    503 	uByte		bDeviceClass;
    504 	uByte		bDeviceSubClass;
    505 	uByte		bDeviceProtocol;
    506 	uByte		bMaxPacketSize0;
    507 	uByte		bNumConfigurations;
    508 	uByte		bReserved;
    509 } UPACKED usb_device_qualifier_t;
    510 #define USB_DEVICE_QUALIFIER_SIZE 10
    511 
    512 typedef struct {
    513 	uByte		bLength;
    514 	uByte		bDescriptorType;
    515 	uByte		bmAttributes;
    516 #define UOTG_SRP	0x01
    517 #define UOTG_HNP	0x02
    518 } UPACKED usb_otg_descriptor_t;
    519 
    520 /* OTG feature selectors */
    521 #define UOTG_B_HNP_ENABLE	3
    522 #define UOTG_A_HNP_SUPPORT	4
    523 #define UOTG_A_ALT_HNP_SUPPORT	5
    524 
    525 typedef struct {
    526 	uByte		bLength;
    527 	uByte		bDescriptorType;
    528 	uByte		bDebugInEndpoint;
    529 	uByte		bDebugOutEndpoint;
    530 } UPACKED usb_debug_descriptor_t;
    531 
    532 typedef struct {
    533 	uWord		wStatus;
    534 /* Device status flags */
    535 #define UDS_SELF_POWERED		0x0001
    536 #define UDS_REMOTE_WAKEUP		0x0002
    537 /* Endpoint status flags */
    538 #define UES_HALT			0x0001
    539 } UPACKED usb_status_t;
    540 
    541 typedef struct {
    542 	uWord		wHubStatus;
    543 #define UHS_LOCAL_POWER			0x0001
    544 #define UHS_OVER_CURRENT		0x0002
    545 	uWord		wHubChange;
    546 } UPACKED usb_hub_status_t;
    547 
    548 typedef struct {
    549 	uWord		wPortStatus;
    550 #define UPS_CURRENT_CONNECT_STATUS	0x0001
    551 #define UPS_PORT_ENABLED		0x0002
    552 #define UPS_SUSPEND			0x0004
    553 #define UPS_OVERCURRENT_INDICATOR	0x0008
    554 #define UPS_RESET			0x0010
    555 #define UPS_PORT_L1			0x0020
    556 #define UPS_PORT_LS_GET(x)		__SHIFTOUT(x, __BITS(8,5))
    557 #define UPS_PORT_LS_U0			0x00
    558 #define UPS_PORT_LS_U1			0x01
    559 #define UPS_PORT_LS_U2			0x02
    560 #define UPS_PORT_LS_U3			0x03
    561 #define UPS_PORT_LS_SS_DIS		0x04
    562 #define UPS_PORT_LS_RX_DET		0x05
    563 #define UPS_PORT_LS_SS_INA		0x06
    564 #define UPS_PORT_LS_POLL		0x07
    565 #define UPS_PORT_LS_RECOVER		0x08
    566 #define UPS_PORT_LS_HOT_RST		0x09
    567 #define UPS_PORT_LS_COMP_MODE		0x0a
    568 #define UPS_PORT_LS_LOOPBACK		0x0b
    569 #define UPS_PORT_LS_RESUME		0x0f
    570 #define UPS_PORT_POWER			0x0100
    571 #define UPS_PORT_POWER_SS		0x0200
    572 #define UPS_FULL_SPEED			0x0000	/* for completeness */
    573 #define UPS_LOW_SPEED			0x0200
    574 #define UPS_HIGH_SPEED			0x0400
    575 #define UPS_SUPER_SPEED			0x0800
    576 #define UPS_PORT_TEST			0x0800
    577 #define UPS_PORT_INDICATOR		0x1000
    578 	uWord		wPortChange;
    579 #define UPS_C_CONNECT_STATUS		0x0001
    580 #define UPS_C_PORT_ENABLED		0x0002
    581 #define UPS_C_SUSPEND			0x0004
    582 #define UPS_C_OVERCURRENT_INDICATOR	0x0008
    583 #define UPS_C_PORT_RESET		0x0010
    584 #define UPS_C_PORT_L1			0x0020
    585 #define UPS_C_BH_PORT_RESET		0x0020
    586 #define UPS_C_PORT_LINK_STATE		0x0040
    587 #define UPS_C_PORT_CONFIG_ERROR		0x0080
    588 } UPACKED usb_port_status_t;
    589 
    590 /* Device class codes */
    591 #define UDCLASS_IN_INTERFACE	0x00
    592 #define UDCLASS_COMM		0x02
    593 #define UDCLASS_HUB		0x09
    594 #define  UDSUBCLASS_HUB		0x00
    595 #define  UDPROTO_FSHUB		0x00
    596 #define  UDPROTO_HSHUBSTT	0x01
    597 #define  UDPROTO_HSHUBMTT	0x02
    598 #define  UDPROTO_SSHUB		0x03
    599 #define UDCLASS_DIAGNOSTIC	0xdc
    600 #define UDCLASS_WIRELESS	0xe0
    601 #define  UDSUBCLASS_RF		0x01
    602 #define   UDPROTO_BLUETOOTH	0x01
    603 #define UDCLASS_VENDOR		0xff
    604 
    605 /* Interface class codes */
    606 #define UICLASS_UNSPEC		0x00
    607 
    608 #define UICLASS_AUDIO		0x01
    609 #define  UISUBCLASS_AUDIOCONTROL	1
    610 #define  UISUBCLASS_AUDIOSTREAM		2
    611 #define  UISUBCLASS_MIDISTREAM		3
    612 
    613 #define UICLASS_VIDEO		0x0e
    614 #define  UISUBCLASS_VIDEOCONTROL	1
    615 #define  UISUBCLASS_VIDEOSTREAMING	2
    616 #define  UISUBCLASS_VIDEOCOLLECTION	3
    617 
    618 #define UICLASS_CDC		0x02 /* communication */
    619 #define	 UISUBCLASS_DIRECT_LINE_CONTROL_MODEL	1
    620 #define  UISUBCLASS_ABSTRACT_CONTROL_MODEL	2
    621 #define	 UISUBCLASS_TELEPHONE_CONTROL_MODEL	3
    622 #define	 UISUBCLASS_MULTICHANNEL_CONTROL_MODEL	4
    623 #define	 UISUBCLASS_CAPI_CONTROLMODEL		5
    624 #define	 UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
    625 #define	 UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
    626 #define	  UIPROTO_CDC_NOCLASS			0 /* no class specific
    627 						     protocol required */
    628 #define   UIPROTO_CDC_AT			1
    629 
    630 #define UICLASS_HID		0x03
    631 #define  UISUBCLASS_BOOT	1
    632 #define  UIPROTO_BOOT_KEYBOARD	1
    633 #define  UIPROTO_MOUSE		2
    634 
    635 #define UICLASS_PHYSICAL	0x05
    636 
    637 #define UICLASS_IMAGE		0x06
    638 
    639 #define UICLASS_PRINTER		0x07
    640 #define  UISUBCLASS_PRINTER	1
    641 #define  UIPROTO_PRINTER_UNI	1
    642 #define  UIPROTO_PRINTER_BI	2
    643 #define  UIPROTO_PRINTER_1284	3
    644 
    645 #define UICLASS_MASS		0x08
    646 #define  UISUBCLASS_RBC		1
    647 #define  UISUBCLASS_SFF8020I	2
    648 #define  UISUBCLASS_QIC157	3
    649 #define  UISUBCLASS_UFI		4
    650 #define  UISUBCLASS_SFF8070I	5
    651 #define  UISUBCLASS_SCSI	6
    652 #define  UIPROTO_MASS_CBI_I	0
    653 #define  UIPROTO_MASS_CBI	1
    654 #define  UIPROTO_MASS_BBB_OLD	2	/* Not in the spec anymore */
    655 #define  UIPROTO_MASS_BBB	80	/* 'P' for the Iomega Zip drive */
    656 #define  UIPROTO_MASS_UAS	98	/* USB Attached SCSI */
    657 
    658 #define UICLASS_HUB		0x09
    659 #define  UISUBCLASS_HUB		0
    660 #define  UIPROTO_FSHUB		0
    661 #define  UIPROTO_HSHUBSTT	0 /* Yes, same as previous */
    662 #define  UIPROTO_HSHUBMTT	1
    663 
    664 #define UICLASS_CDC_DATA	0x0a
    665 #define  UISUBCLASS_DATA		0
    666 #define   UIPROTO_DATA_ISDNBRI		0x30    /* Physical iface */
    667 #define   UIPROTO_DATA_HDLC		0x31    /* HDLC */
    668 #define   UIPROTO_DATA_TRANSPARENT	0x32    /* Transparent */
    669 #define   UIPROTO_DATA_Q921M		0x50    /* Management for Q921 */
    670 #define   UIPROTO_DATA_Q921		0x51    /* Data for Q921 */
    671 #define   UIPROTO_DATA_Q921TM		0x52    /* TEI multiplexer for Q921 */
    672 #define   UIPROTO_DATA_V42BIS		0x90    /* Data compression */
    673 #define   UIPROTO_DATA_Q931		0x91    /* Euro-ISDN */
    674 #define   UIPROTO_DATA_V120		0x92    /* V.24 rate adaption */
    675 #define   UIPROTO_DATA_CAPI		0x93    /* CAPI 2.0 commands */
    676 #define   UIPROTO_DATA_HOST_BASED	0xfd    /* Host based driver */
    677 #define   UIPROTO_DATA_PUF		0xfe    /* see Prot. Unit Func. Desc.*/
    678 #define   UIPROTO_DATA_VENDOR		0xff    /* Vendor specific */
    679 
    680 #define UICLASS_SMARTCARD	0x0b
    681 
    682 /*#define UICLASS_FIRM_UPD	0x0c*/
    683 
    684 #define UICLASS_SECURITY	0x0d
    685 
    686 #define UICLASS_DIAGNOSTIC	0xdc
    687 
    688 #define UICLASS_WIRELESS	0xe0
    689 #define  UISUBCLASS_RF			0x01
    690 #define   UIPROTO_BLUETOOTH		0x01
    691 #define   UIPROTO_RNDIS			0x03
    692 
    693 #define UICLASS_APPL_SPEC	0xfe
    694 #define  UISUBCLASS_FIRMWARE_DOWNLOAD	1
    695 #define  UISUBCLASS_IRDA		2
    696 #define  UIPROTO_IRDA			0
    697 
    698 #define UICLASS_VENDOR		0xff
    699 
    700 
    701 #define USB_HUB_MAX_DEPTH 5
    702 
    703 /*
    704  * Minimum time a device needs to be powered down to go through
    705  * a power cycle.  XXX Are these time in the spec?
    706  */
    707 #define USB_POWER_DOWN_TIME	200 /* ms */
    708 #define USB_PORT_POWER_DOWN_TIME	100 /* ms */
    709 
    710 #if 0
    711 /* These are the values from the spec. */
    712 #define USB_PORT_RESET_DELAY	10  /* ms */
    713 #define USB_PORT_ROOT_RESET_DELAY 50  /* ms */
    714 #define USB_PORT_RESET_RECOVERY	10  /* ms */
    715 #define USB_PORT_POWERUP_DELAY	100 /* ms */
    716 #define USB_SET_ADDRESS_SETTLE	2   /* ms */
    717 #define USB_RESUME_DELAY	(20*5)  /* ms */
    718 #define USB_RESUME_WAIT		10  /* ms */
    719 #define USB_RESUME_RECOVERY	10  /* ms */
    720 #define USB_EXTRA_POWER_UP_TIME	0   /* ms */
    721 #else
    722 /* Allow for marginal (i.e. non-conforming) devices. */
    723 #define USB_PORT_RESET_DELAY	50  /* ms */
    724 #define USB_PORT_ROOT_RESET_DELAY 250  /* ms */
    725 #define USB_PORT_RESET_RECOVERY	250  /* ms */
    726 #define USB_PORT_POWERUP_DELAY	300 /* ms */
    727 #define USB_SET_ADDRESS_SETTLE	10  /* ms */
    728 #define USB_RESUME_DELAY	(50*5)  /* ms */
    729 #define USB_RESUME_WAIT		50  /* ms */
    730 #define USB_RESUME_RECOVERY	50  /* ms */
    731 #define USB_EXTRA_POWER_UP_TIME	20  /* ms */
    732 #endif
    733 
    734 #define USB_MIN_POWER		100 /* mA */
    735 #define USB_MAX_POWER		500 /* mA */
    736 
    737 #define USB_BUS_RESET_DELAY	100 /* ms XXX?*/
    738 
    739 
    740 #define USB_UNCONFIG_NO 0
    741 #define USB_UNCONFIG_INDEX (-1)
    742 
    743 
    744 /* Packet IDs */
    745 #define UPID_RESERVED	0xf0
    746 #define UPID_OUT	0xe1
    747 #define UPID_ACK	0xd2
    748 #define UPID_DATA0	0xc3
    749 #define UPID_PING	0xb4
    750 #define UPID_SOF	0xa5
    751 #define UPID_NYET	0x96
    752 #define UPID_DATA2	0x87
    753 #define UPID_SPLIT	0x78
    754 #define UPID_IN		0x69
    755 #define UPID_NAK	0x5a
    756 #define UPID_DATA1	0x4b
    757 #define UPID_ERR	0x3c
    758 #define UPID_PREAMBLE	0x3c
    759 #define UPID_SETUP	0x2d
    760 #define UPID_STALL	0x1e
    761 #define UPID_MDATA	0x0f
    762 
    763 
    764 /*** ioctl() related stuff ***/
    765 
    766 struct usb_ctl_request {
    767 	int	ucr_addr;
    768 	usb_device_request_t ucr_request;
    769 	void	*ucr_data;
    770 	int	ucr_flags;
    771 #define USBD_SHORT_XFER_OK	0x04	/* allow short reads */
    772 	int	ucr_actlen;		/* actual length transferred */
    773 };
    774 
    775 struct usb_alt_interface {
    776 	int	uai_config_index;
    777 	int	uai_interface_index;
    778 	int	uai_alt_no;
    779 };
    780 
    781 #define USB_CURRENT_CONFIG_INDEX (-1)
    782 #define USB_CURRENT_ALT_INDEX (-1)
    783 
    784 struct usb_config_desc {
    785 	int	ucd_config_index;
    786 	usb_config_descriptor_t ucd_desc;
    787 };
    788 
    789 struct usb_interface_desc {
    790 	int	uid_config_index;
    791 	int	uid_interface_index;
    792 	int	uid_alt_index;
    793 	usb_interface_descriptor_t uid_desc;
    794 };
    795 
    796 struct usb_endpoint_desc {
    797 	int	ued_config_index;
    798 	int	ued_interface_index;
    799 	int	ued_alt_index;
    800 	int	ued_endpoint_index;
    801 	usb_endpoint_descriptor_t ued_desc;
    802 };
    803 
    804 struct usb_full_desc {
    805 	int	ufd_config_index;
    806 	u_int	ufd_size;
    807 	u_char	*ufd_data;
    808 };
    809 
    810 struct usb_string_desc {
    811 	int	usd_string_index;
    812 	int	usd_language_id;
    813 	usb_string_descriptor_t usd_desc;
    814 };
    815 
    816 struct usb_ctl_report_desc {
    817 	int	ucrd_size;
    818 	u_char	ucrd_data[1024];	/* filled data size will vary */
    819 };
    820 
    821 typedef struct { uint32_t cookie; } usb_event_cookie_t;
    822 
    823 #define USB_MAX_DEVNAMES 4
    824 #define USB_MAX_DEVNAMELEN 16
    825 struct usb_device_info {
    826 	uint8_t		udi_bus;
    827 	uint8_t		udi_addr;	/* device address */
    828 	usb_event_cookie_t udi_cookie;
    829 	char		udi_product[USB_MAX_ENCODED_STRING_LEN];
    830 	char		udi_vendor[USB_MAX_ENCODED_STRING_LEN];
    831 	char		udi_release[8];
    832 	char		udi_serial[USB_MAX_ENCODED_STRING_LEN];
    833 	uint16_t	udi_productNo;
    834 	uint16_t	udi_vendorNo;
    835 	uint16_t	udi_releaseNo;
    836 	uint8_t		udi_class;
    837 	uint8_t		udi_subclass;
    838 	uint8_t		udi_protocol;
    839 	uint8_t		udi_config;
    840 	uint8_t		udi_speed;
    841 #define USB_SPEED_LOW  1
    842 #define USB_SPEED_FULL 2
    843 #define USB_SPEED_HIGH 3
    844 #define USB_SPEED_SUPER 4
    845 	int		udi_power;	/* power consumption in mA, 0 if selfpowered */
    846 	int		udi_nports;
    847 	char		udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
    848 	uint8_t		udi_ports[16];/* hub only: addresses of devices on ports */
    849 #define USB_PORT_ENABLED 0xff
    850 #define USB_PORT_SUSPENDED 0xfe
    851 #define USB_PORT_POWERED 0xfd
    852 #define USB_PORT_DISABLED 0xfc
    853 };
    854 
    855 /* <=3.0 had this layout of the structure */
    856 struct usb_device_info_old {
    857 	uint8_t		udi_bus;
    858 	uint8_t		udi_addr;       /* device address */
    859 	usb_event_cookie_t udi_cookie;
    860 	char		udi_product[USB_MAX_STRING_LEN];
    861 	char		udi_vendor[USB_MAX_STRING_LEN];
    862 	char		udi_release[8];
    863 	uint16_t	udi_productNo;
    864 	uint16_t	udi_vendorNo;
    865 	uint16_t	udi_releaseNo;
    866 	uint8_t		udi_class;
    867 	uint8_t		udi_subclass;
    868 	uint8_t		udi_protocol;
    869 	uint8_t		udi_config;
    870 	uint8_t		udi_speed;
    871 	int		udi_power;      /* power consumption in mA, 0 if selfpowered */
    872 	int		udi_nports;
    873 	char		udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
    874 	uint8_t		udi_ports[16];/* hub only: addresses of devices on ports */
    875 };
    876 
    877 struct usb_ctl_report {
    878 	int	ucr_report;
    879 	u_char	ucr_data[1024];	/* filled data size will vary */
    880 };
    881 
    882 struct usb_device_stats {
    883 	u_long	uds_requests[4];	/* indexed by transfer type UE_* */
    884 };
    885 
    886 struct usb_bulk_ra_wb_opt {
    887 	u_int	ra_wb_buffer_size;
    888 	u_int	ra_wb_request_size;
    889 };
    890 
    891 /* Events that can be read from /dev/usb */
    892 struct usb_event {
    893 	int			ue_type;
    894 #define USB_EVENT_CTRLR_ATTACH 1
    895 #define USB_EVENT_CTRLR_DETACH 2
    896 #define USB_EVENT_DEVICE_ATTACH 3
    897 #define USB_EVENT_DEVICE_DETACH 4
    898 #define USB_EVENT_DRIVER_ATTACH 5
    899 #define USB_EVENT_DRIVER_DETACH 6
    900 #define USB_EVENT_IS_ATTACH(n) ((n) == USB_EVENT_CTRLR_ATTACH || (n) == USB_EVENT_DEVICE_ATTACH || (n) == USB_EVENT_DRIVER_ATTACH)
    901 #define USB_EVENT_IS_DETACH(n) ((n) == USB_EVENT_CTRLR_DETACH || (n) == USB_EVENT_DEVICE_DETACH || (n) == USB_EVENT_DRIVER_DETACH)
    902 	struct timespec		ue_time;
    903 	union {
    904 		struct {
    905 			int			ue_bus;
    906 		} ue_ctrlr;
    907 		struct usb_device_info		ue_device;
    908 		struct {
    909 			usb_event_cookie_t	ue_cookie;
    910 			char			ue_devname[16];
    911 		} ue_driver;
    912 	} u;
    913 };
    914 
    915 /* old <=3.0 compat event */
    916 struct usb_event_old {
    917 	int                     ue_type;
    918 	struct timespec         ue_time;
    919 	union {
    920 		struct {
    921 			int                     ue_bus;
    922 		} ue_ctrlr;
    923 		struct usb_device_info_old          ue_device;
    924 		struct {
    925 			usb_event_cookie_t      ue_cookie;
    926 			char                    ue_devname[16];
    927 		} ue_driver;
    928 	} u;
    929 };
    930 
    931 
    932 /* USB controller */
    933 #define USB_REQUEST		_IOWR('U', 1, struct usb_ctl_request)
    934 #define USB_SETDEBUG		_IOW ('U', 2, int)
    935 #define USB_DISCOVER		_IO  ('U', 3)
    936 #define USB_DEVICEINFO		_IOWR('U', 4, struct usb_device_info)
    937 #define USB_DEVICEINFO_OLD	_IOWR('U', 4, struct usb_device_info_old)
    938 #define USB_DEVICESTATS		_IOR ('U', 5, struct usb_device_stats)
    939 
    940 /* Generic HID device */
    941 #define USB_GET_REPORT_DESC	_IOR ('U', 21, struct usb_ctl_report_desc)
    942 #define USB_SET_IMMED		_IOW ('U', 22, int)
    943 #define USB_GET_REPORT		_IOWR('U', 23, struct usb_ctl_report)
    944 #define USB_SET_REPORT		_IOW ('U', 24, struct usb_ctl_report)
    945 #define USB_GET_REPORT_ID	_IOR ('U', 25, int)
    946 
    947 /* Generic USB device */
    948 #define USB_GET_CONFIG		_IOR ('U', 100, int)
    949 #define USB_SET_CONFIG		_IOW ('U', 101, int)
    950 #define USB_GET_ALTINTERFACE	_IOWR('U', 102, struct usb_alt_interface)
    951 #define USB_SET_ALTINTERFACE	_IOWR('U', 103, struct usb_alt_interface)
    952 #define USB_GET_NO_ALT		_IOWR('U', 104, struct usb_alt_interface)
    953 #define USB_GET_DEVICE_DESC	_IOR ('U', 105, usb_device_descriptor_t)
    954 #define USB_GET_CONFIG_DESC	_IOWR('U', 106, struct usb_config_desc)
    955 #define USB_GET_INTERFACE_DESC	_IOWR('U', 107, struct usb_interface_desc)
    956 #define USB_GET_ENDPOINT_DESC	_IOWR('U', 108, struct usb_endpoint_desc)
    957 #define USB_GET_FULL_DESC	_IOWR('U', 109, struct usb_full_desc)
    958 #define USB_GET_STRING_DESC	_IOWR('U', 110, struct usb_string_desc)
    959 #define USB_DO_REQUEST		_IOWR('U', 111, struct usb_ctl_request)
    960 #define USB_GET_DEVICEINFO	_IOR ('U', 112, struct usb_device_info)
    961 #define USB_GET_DEVICEINFO_OLD	_IOR ('U', 112, struct usb_device_info_old)
    962 #define USB_SET_SHORT_XFER	_IOW ('U', 113, int)
    963 #define USB_SET_TIMEOUT		_IOW ('U', 114, int)
    964 #define USB_SET_BULK_RA		_IOW ('U', 115, int)
    965 #define USB_SET_BULK_WB		_IOW ('U', 116, int)
    966 #define USB_SET_BULK_RA_OPT	_IOW ('U', 117, struct usb_bulk_ra_wb_opt)
    967 #define USB_SET_BULK_WB_OPT	_IOW ('U', 118, struct usb_bulk_ra_wb_opt)
    968 
    969 /* Modem device */
    970 #define USB_GET_CM_OVER_DATA	_IOR ('U', 130, int)
    971 #define USB_SET_CM_OVER_DATA	_IOW ('U', 131, int)
    972 
    973 #endif /* _USB_H_ */
    974