Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / usb_gadget / usb_constants.py
blob39710c2695228800415d5ab57e75c4955705d1cd
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """USB constant definitions.
6 """
9 class DescriptorType(object):
10 """Descriptor Types.
12 See Universal Serial Bus Specification Revision 2.0 Table 9-5.
13 """
14 DEVICE = 1
15 CONFIGURATION = 2
16 STRING = 3
17 INTERFACE = 4
18 ENDPOINT = 5
19 QUALIFIER = 6
20 OTHER_SPEED_CONFIGURATION = 7
21 BOS = 15
22 DEVICE_CAPABILITY = 16
25 class CapabilityType(object):
26 """Device capability types.
28 See Universal Serial Bus 3.1 Specification, Revision 1.0 Table 9-14.
29 """
30 WIRELESS_USB = 0x01
31 USB_20_EXTENSION = 0x02
32 SUPERSPEED_USB = 0x03
33 CONTAINER_ID = 0x04
34 PLATFORM = 0x05
35 POWER_DELIVERY_CAPABILITY = 0x06
36 BATTERY_INFO_CAPABILITY = 0x07
37 PD_CONSUMER_PORT_CAPABILITY = 0x08
38 PD_PROVIDER_PORT_CAPABILITY = 0x09
39 SUPERSPEED_PLUS = 0x0A
40 PRECISION_TIME_MEASUREMENT = 0x0B
41 WIRELESS_USB_EXT = 0x0C
44 class DeviceClass(object):
45 """Class code.
47 See http://www.usb.org/developers/defined_class.
48 """
49 PER_INTERFACE = 0
50 AUDIO = 1
51 COMM = 2
52 HID = 3
53 PHYSICAL = 5
54 STILL_IMAGE = 6
55 PRINTER = 7
56 MASS_STORAGE = 8
57 HUB = 9
58 CDC_DATA = 10
59 CSCID = 11
60 CONTENT_SEC = 13
61 VIDEO = 14
62 VENDOR = 0xFF
65 class DeviceSubClass(object):
66 """Subclass code.
68 See http://www.usb.org/developers/defined_class.
69 """
70 PER_INTERFACE = 0
71 VENDOR = 0xFF
74 class DeviceProtocol(object):
75 """Protocol code.
77 See http://www.usb.org/developers/defined_class.
78 """
79 PER_INTERFACE = 0
80 VENDOR = 0xFF
83 class InterfaceClass(object):
84 """Class code.
86 See http://www.usb.org/developers/defined_class.
87 """
88 VENDOR = 0xFF
91 class InterfaceSubClass(object):
92 """Subclass code.
94 See http://www.usb.org/developers/defined_class.
95 """
96 VENDOR = 0xFF
99 class InterfaceProtocol(object):
100 """Protocol code.
102 See http://www.usb.org/developers/defined_class.
104 VENDOR = 0xFF
107 class TransferType(object):
108 """Transfer Type.
110 See http://www.usb.org/developers/defined_class.
112 MASK = 3
113 CONTROL = 0
114 ISOCHRONOUS = 1
115 BULK = 2
116 INTERRUPT = 3
119 class Dir(object):
120 """Data transfer direction.
122 See Universal Serial Bus Specification Revision 2.0 Table 9-2.
124 OUT = 0
125 IN = 0x80
128 class Type(object):
129 """Request Type.
131 See Universal Serial Bus Specification Revision 2.0 Table 9-2.
133 MASK = 0x60
134 STANDARD = 0x00
135 CLASS = 0x20
136 VENDOR = 0x40
137 RESERVED = 0x60
140 class Recipient(object):
141 """Request Recipient.
143 See Universal Serial Bus Specification Revision 2.0 Table 9-2.
145 MASK = 0x1f
146 DEVICE = 0
147 INTERFACE = 1
148 ENDPOINT = 2
149 OTHER = 3
152 class Request(object):
153 """Standard Request Codes.
155 See Universal Serial Bus Specification Revision 2.0 Table 9-4.
157 GET_STATUS = 0x00
158 CLEAR_FEATURE = 0x01
159 SET_FEATURE = 0x03
160 SET_ADDRESS = 0x05
161 GET_DESCRIPTOR = 0x06
162 SET_DESCRIPTOR = 0x07
163 GET_CONFIGURATION = 0x08
164 SET_CONFIGURATION = 0x09
165 GET_INTERFACE = 0x0A
166 SET_INTERFACE = 0x0B
167 SYNCH_FRAME = 0x0C
168 SET_SEL = 0x30
169 SET_ISOCH_DELAY = 0x31
172 class Speed(object):
173 UNKNOWN = 0
174 LOW = 1
175 FULL = 2
176 HIGH = 3
177 WIRELESS = 4
178 SUPER = 5
181 class VendorID(object):
182 GOOGLE = 0x18D1
185 class ProductID(object):
186 GOOGLE_TEST_GADGET = 0x58F0
187 GOOGLE_KEYBOARD_GADGET = 0x58F1
188 GOOGLE_MOUSE_GADGET = 0x58F2
189 GOOGLE_HID_ECHO_GADGET = 0x58F3
190 GOOGLE_ECHO_GADGET = 0x58F4
191 GOOGLE_COMPOSITE_ECHO_GADGET = 0x58F5