1 /****************************************************************************
2 ****************************************************************************
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
10 ****************************************************************************
11 ****************************************************************************/
12 #ifndef __LINUX_USB_CH9_H
13 #define __LINUX_USB_CH9_H
15 #include <linux/types.h>
18 #define USB_DIR_IN 0x80
20 #define USB_TYPE_MASK (0x03 << 5)
21 #define USB_TYPE_STANDARD (0x00 << 5)
22 #define USB_TYPE_CLASS (0x01 << 5)
23 #define USB_TYPE_VENDOR (0x02 << 5)
24 #define USB_TYPE_RESERVED (0x03 << 5)
26 #define USB_RECIP_MASK 0x1f
27 #define USB_RECIP_DEVICE 0x00
28 #define USB_RECIP_INTERFACE 0x01
29 #define USB_RECIP_ENDPOINT 0x02
30 #define USB_RECIP_OTHER 0x03
32 #define USB_RECIP_PORT 0x04
33 #define USB_RECIP_RPIPE 0x05
35 #define USB_REQ_GET_STATUS 0x00
36 #define USB_REQ_CLEAR_FEATURE 0x01
37 #define USB_REQ_SET_FEATURE 0x03
38 #define USB_REQ_SET_ADDRESS 0x05
39 #define USB_REQ_GET_DESCRIPTOR 0x06
40 #define USB_REQ_SET_DESCRIPTOR 0x07
41 #define USB_REQ_GET_CONFIGURATION 0x08
42 #define USB_REQ_SET_CONFIGURATION 0x09
43 #define USB_REQ_GET_INTERFACE 0x0A
44 #define USB_REQ_SET_INTERFACE 0x0B
45 #define USB_REQ_SYNCH_FRAME 0x0C
47 #define USB_REQ_SET_ENCRYPTION 0x0D
48 #define USB_REQ_GET_ENCRYPTION 0x0E
49 #define USB_REQ_RPIPE_ABORT 0x0E
50 #define USB_REQ_SET_HANDSHAKE 0x0F
51 #define USB_REQ_RPIPE_RESET 0x0F
52 #define USB_REQ_GET_HANDSHAKE 0x10
53 #define USB_REQ_SET_CONNECTION 0x11
54 #define USB_REQ_SET_SECURITY_DATA 0x12
55 #define USB_REQ_GET_SECURITY_DATA 0x13
56 #define USB_REQ_SET_WUSB_DATA 0x14
57 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15
58 #define USB_REQ_LOOPBACK_DATA_READ 0x16
59 #define USB_REQ_SET_INTERFACE_DS 0x17
61 #define USB_DEVICE_SELF_POWERED 0
62 #define USB_DEVICE_REMOTE_WAKEUP 1
63 #define USB_DEVICE_TEST_MODE 2
64 #define USB_DEVICE_BATTERY 2
65 #define USB_DEVICE_B_HNP_ENABLE 3
66 #define USB_DEVICE_WUSB_DEVICE 3
67 #define USB_DEVICE_A_HNP_SUPPORT 4
68 #define USB_DEVICE_A_ALT_HNP_SUPPORT 5
69 #define USB_DEVICE_DEBUG_MODE 6
71 #define USB_ENDPOINT_HALT 0
73 struct usb_ctrlrequest {
79 } __attribute__ ((packed));
81 #define USB_DT_DEVICE 0x01
82 #define USB_DT_CONFIG 0x02
83 #define USB_DT_STRING 0x03
84 #define USB_DT_INTERFACE 0x04
85 #define USB_DT_ENDPOINT 0x05
86 #define USB_DT_DEVICE_QUALIFIER 0x06
87 #define USB_DT_OTHER_SPEED_CONFIG 0x07
88 #define USB_DT_INTERFACE_POWER 0x08
90 #define USB_DT_OTG 0x09
91 #define USB_DT_DEBUG 0x0a
92 #define USB_DT_INTERFACE_ASSOCIATION 0x0b
94 #define USB_DT_SECURITY 0x0c
95 #define USB_DT_KEY 0x0d
96 #define USB_DT_ENCRYPTION_TYPE 0x0e
97 #define USB_DT_BOS 0x0f
98 #define USB_DT_DEVICE_CAPABILITY 0x10
99 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
100 #define USB_DT_WIRE_ADAPTER 0x21
101 #define USB_DT_RPIPE 0x22
103 #define USB_DT_CS_DEVICE 0x21
104 #define USB_DT_CS_CONFIG 0x22
105 #define USB_DT_CS_STRING 0x23
106 #define USB_DT_CS_INTERFACE 0x24
107 #define USB_DT_CS_ENDPOINT 0x25
109 struct usb_descriptor_header {
111 __u8 bDescriptorType;
112 } __attribute__ ((packed));
114 struct usb_device_descriptor {
116 __u8 bDescriptorType;
120 __u8 bDeviceSubClass;
121 __u8 bDeviceProtocol;
122 __u8 bMaxPacketSize0;
129 __u8 bNumConfigurations;
130 } __attribute__ ((packed));
132 #define USB_DT_DEVICE_SIZE 18
134 #define USB_CLASS_PER_INTERFACE 0
135 #define USB_CLASS_AUDIO 1
136 #define USB_CLASS_COMM 2
137 #define USB_CLASS_HID 3
138 #define USB_CLASS_PHYSICAL 5
139 #define USB_CLASS_STILL_IMAGE 6
140 #define USB_CLASS_PRINTER 7
141 #define USB_CLASS_MASS_STORAGE 8
142 #define USB_CLASS_HUB 9
143 #define USB_CLASS_CDC_DATA 0x0a
144 #define USB_CLASS_CSCID 0x0b
145 #define USB_CLASS_CONTENT_SEC 0x0d
146 #define USB_CLASS_VIDEO 0x0e
147 #define USB_CLASS_WIRELESS_CONTROLLER 0xe0
148 #define USB_CLASS_APP_SPEC 0xfe
149 #define USB_CLASS_VENDOR_SPEC 0xff
151 struct usb_config_descriptor {
153 __u8 bDescriptorType;
157 __u8 bConfigurationValue;
161 } __attribute__ ((packed));
163 #define USB_DT_CONFIG_SIZE 9
165 #define USB_CONFIG_ATT_ONE (1 << 7)
166 #define USB_CONFIG_ATT_SELFPOWER (1 << 6)
167 #define USB_CONFIG_ATT_WAKEUP (1 << 5)
168 #define USB_CONFIG_ATT_BATTERY (1 << 4)
170 struct usb_string_descriptor {
172 __u8 bDescriptorType;
175 } __attribute__ ((packed));
177 struct usb_interface_descriptor {
179 __u8 bDescriptorType;
181 __u8 bInterfaceNumber;
182 __u8 bAlternateSetting;
184 __u8 bInterfaceClass;
185 __u8 bInterfaceSubClass;
186 __u8 bInterfaceProtocol;
188 } __attribute__ ((packed));
190 #define USB_DT_INTERFACE_SIZE 9
192 struct usb_endpoint_descriptor {
194 __u8 bDescriptorType;
196 __u8 bEndpointAddress;
198 __le16 wMaxPacketSize;
203 } __attribute__ ((packed));
205 #define USB_DT_ENDPOINT_SIZE 7
206 #define USB_DT_ENDPOINT_AUDIO_SIZE 9
208 #define USB_ENDPOINT_NUMBER_MASK 0x0f
209 #define USB_ENDPOINT_DIR_MASK 0x80
211 #define USB_ENDPOINT_XFERTYPE_MASK 0x03
212 #define USB_ENDPOINT_XFER_CONTROL 0
213 #define USB_ENDPOINT_XFER_ISOC 1
214 #define USB_ENDPOINT_XFER_BULK 2
215 #define USB_ENDPOINT_XFER_INT 3
216 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
218 struct usb_qualifier_descriptor {
220 __u8 bDescriptorType;
224 __u8 bDeviceSubClass;
225 __u8 bDeviceProtocol;
226 __u8 bMaxPacketSize0;
227 __u8 bNumConfigurations;
229 } __attribute__ ((packed));
231 struct usb_otg_descriptor {
233 __u8 bDescriptorType;
236 } __attribute__ ((packed));
238 #define USB_OTG_SRP (1 << 0)
239 #define USB_OTG_HNP (1 << 1)
241 struct usb_debug_descriptor {
243 __u8 bDescriptorType;
245 __u8 bDebugInEndpoint;
246 __u8 bDebugOutEndpoint;
249 struct usb_interface_assoc_descriptor {
251 __u8 bDescriptorType;
253 __u8 bFirstInterface;
254 __u8 bInterfaceCount;
256 __u8 bFunctionSubClass;
257 __u8 bFunctionProtocol;
259 } __attribute__ ((packed));
261 struct usb_security_descriptor {
263 __u8 bDescriptorType;
266 __u8 bNumEncryptionTypes;
269 struct usb_key_descriptor {
271 __u8 bDescriptorType;
278 struct usb_encryption_descriptor {
280 __u8 bDescriptorType;
282 __u8 bEncryptionType;
283 #define USB_ENC_TYPE_UNSECURE 0
284 #define USB_ENC_TYPE_WIRED 1
285 #define USB_ENC_TYPE_CCM_1 2
286 #define USB_ENC_TYPE_RSA_1 3
287 __u8 bEncryptionValue;
291 struct usb_bos_descriptor {
293 __u8 bDescriptorType;
299 struct usb_dev_cap_header {
301 __u8 bDescriptorType;
302 __u8 bDevCapabilityType;
305 #define USB_CAP_TYPE_WIRELESS_USB 1
307 struct usb_wireless_cap_descriptor {
309 __u8 bDescriptorType;
310 __u8 bDevCapabilityType;
313 #define USB_WIRELESS_P2P_DRD (1 << 1)
314 #define USB_WIRELESS_BEACON_MASK (3 << 2)
315 #define USB_WIRELESS_BEACON_SELF (1 << 2)
316 #define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
317 #define USB_WIRELESS_BEACON_NONE (3 << 2)
319 #define USB_WIRELESS_PHY_53 (1 << 0)
320 #define USB_WIRELESS_PHY_80 (1 << 1)
321 #define USB_WIRELESS_PHY_107 (1 << 2)
322 #define USB_WIRELESS_PHY_160 (1 << 3)
323 #define USB_WIRELESS_PHY_200 (1 << 4)
324 #define USB_WIRELESS_PHY_320 (1 << 5)
325 #define USB_WIRELESS_PHY_400 (1 << 6)
326 #define USB_WIRELESS_PHY_480 (1 << 7)
327 __u8 bmTFITXPowerInfo;
328 __u8 bmFFITXPowerInfo;
333 struct usb_wireless_ep_comp_descriptor {
335 __u8 bDescriptorType;
339 __le16 wMaxStreamDelay;
340 __le16 wOverTheAirPacketSize;
341 __u8 bOverTheAirInterval;
342 __u8 bmCompAttributes;
343 #define USB_ENDPOINT_SWITCH_MASK 0x03
344 #define USB_ENDPOINT_SWITCH_NO 0
345 #define USB_ENDPOINT_SWITCH_SWITCH 1
346 #define USB_ENDPOINT_SWITCH_SCALE 2
349 struct usb_handshake {
359 struct usb_connection_context {
365 enum usb_device_speed {
366 USB_SPEED_UNKNOWN = 0,
367 USB_SPEED_LOW, USB_SPEED_FULL,
372 enum usb_device_state {
374 USB_STATE_NOTATTACHED = 0,
378 USB_STATE_UNAUTHENTICATED,
379 USB_STATE_RECONNECTING,
382 USB_STATE_CONFIGURED,