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