• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4
5"""USB constant definitions.
6"""
7
8
9class DescriptorType(object):
10  """Descriptor Types.
11
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
22
23class DeviceClass(object):
24  """Class code.
25
26  See http://www.usb.org/developers/defined_class.
27  """
28  PER_INTERFACE = 0
29  AUDIO = 1
30  COMM = 2
31  HID = 3
32  PHYSICAL = 5
33  STILL_IMAGE = 6
34  PRINTER = 7
35  MASS_STORAGE = 8
36  HUB = 9
37  CDC_DATA = 10
38  CSCID = 11
39  CONTENT_SEC = 13
40  VIDEO = 14
41  VENDOR = 0xFF
42
43
44class DeviceSubClass(object):
45  """Subclass code.
46
47  See http://www.usb.org/developers/defined_class.
48  """
49  PER_INTERFACE = 0
50  VENDOR = 0xFF
51
52
53class DeviceProtocol(object):
54  """Protocol code.
55
56  See http://www.usb.org/developers/defined_class.
57  """
58  PER_INTERFACE = 0
59  VENDOR = 0xFF
60
61
62class InterfaceClass(object):
63  """Class code.
64
65  See http://www.usb.org/developers/defined_class.
66  """
67  VENDOR = 0xFF
68
69
70class InterfaceSubClass(object):
71  """Subclass code.
72
73  See http://www.usb.org/developers/defined_class.
74  """
75  VENDOR = 0xFF
76
77
78class InterfaceProtocol(object):
79  """Protocol code.
80
81  See http://www.usb.org/developers/defined_class.
82  """
83  VENDOR = 0xFF
84
85
86class TransferType(object):
87  """Transfer Type.
88
89  See http://www.usb.org/developers/defined_class.
90  """
91  MASK = 3
92  CONTROL = 0
93  ISOCHRONOUS = 1
94  BULK = 2
95  INTERRUPT = 3
96
97
98class Dir(object):
99  """Data transfer direction.
100
101  See Universal Serial Bus Specification Revision 2.0 Table 9-2.
102  """
103  OUT = 0
104  IN = 0x80
105
106
107class Type(object):
108  """Request Type.
109
110  See Universal Serial Bus Specification Revision 2.0 Table 9-2.
111  """
112  MASK = 0x60
113  STANDARD = 0x00
114  CLASS = 0x20
115  VENDOR = 0x40
116  RESERVED = 0x60
117
118
119class Recipient(object):
120  """Request Recipient.
121
122  See Universal Serial Bus Specification Revision 2.0 Table 9-2.
123  """
124  MASK = 0x1f
125  DEVICE = 0
126  INTERFACE = 1
127  ENDPOINT = 2
128  OTHER = 3
129
130
131class Request(object):
132  """Standard Request Codes.
133
134  See Universal Serial Bus Specification Revision 2.0 Table 9-4.
135  """
136  GET_STATUS = 0x00
137  CLEAR_FEATURE = 0x01
138  SET_FEATURE = 0x03
139  SET_ADDRESS = 0x05
140  GET_DESCRIPTOR = 0x06
141  SET_DESCRIPTOR = 0x07
142  GET_CONFIGURATION = 0x08
143  SET_CONFIGURATION = 0x09
144  GET_INTERFACE = 0x0A
145  SET_INTERFACE = 0x0B
146  SYNCH_FRAME = 0x0C
147  SET_SEL = 0x30
148  SET_ISOCH_DELAY = 0x31
149
150
151class Speed(object):
152  UNKNOWN = 0
153  LOW = 1
154  FULL = 2
155  HIGH = 3
156  WIRELESS = 4
157  SUPER = 5
158
159
160class VendorID(object):
161  GOOGLE = 0x18D1
162
163
164class ProductID(object):
165  GOOGLE_TEST_GADGET = 0x58F0
166  GOOGLE_KEYBOARD_GADGET = 0x58F1
167  GOOGLE_MOUSE_GADGET = 0x58F2
168  GOOGLE_HID_ECHO_GADGET = 0x58F3
169  GOOGLE_ECHO_GADGET = 0x58F4
170