forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusb_constants.py
169 lines (126 loc) · 2.82 KB
/
usb_constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""USB constant definitions.
"""
class DescriptorType(object):
"""Descriptor Types.
See Universal Serial Bus Specification Revision 2.0 Table 9-5.
"""
DEVICE = 1
CONFIGURATION = 2
STRING = 3
INTERFACE = 4
ENDPOINT = 5
QUALIFIER = 6
OTHER_SPEED_CONFIGURATION = 7
class DeviceClass(object):
"""Class code.
See http://www.usb.org/developers/defined_class.
"""
PER_INTERFACE = 0
AUDIO = 1
COMM = 2
HID = 3
PHYSICAL = 5
STILL_IMAGE = 6
PRINTER = 7
MASS_STORAGE = 8
HUB = 9
CDC_DATA = 10
CSCID = 11
CONTENT_SEC = 13
VIDEO = 14
VENDOR = 0xFF
class DeviceSubClass(object):
"""Subclass code.
See http://www.usb.org/developers/defined_class.
"""
PER_INTERFACE = 0
VENDOR = 0xFF
class DeviceProtocol(object):
"""Protocol code.
See http://www.usb.org/developers/defined_class.
"""
PER_INTERFACE = 0
VENDOR = 0xFF
class InterfaceClass(object):
"""Class code.
See http://www.usb.org/developers/defined_class.
"""
VENDOR = 0xFF
class InterfaceSubClass(object):
"""Subclass code.
See http://www.usb.org/developers/defined_class.
"""
VENDOR = 0xFF
class InterfaceProtocol(object):
"""Protocol code.
See http://www.usb.org/developers/defined_class.
"""
VENDOR = 0xFF
class TransferType(object):
"""Transfer Type.
See http://www.usb.org/developers/defined_class.
"""
MASK = 3
CONTROL = 0
ISOCHRONOUS = 1
BULK = 2
INTERRUPT = 3
class Dir(object):
"""Data transfer direction.
See Universal Serial Bus Specification Revision 2.0 Table 9-2.
"""
OUT = 0
IN = 0x80
class Type(object):
"""Request Type.
See Universal Serial Bus Specification Revision 2.0 Table 9-2.
"""
MASK = 0x60
STANDARD = 0x00
CLASS = 0x20
VENDOR = 0x40
RESERVED = 0x60
class Recipient(object):
"""Request Recipient.
See Universal Serial Bus Specification Revision 2.0 Table 9-2.
"""
MASK = 0x1f
DEVICE = 0
INTERFACE = 1
ENDPOINT = 2
OTHER = 3
class Request(object):
"""Standard Request Codes.
See Universal Serial Bus Specification Revision 2.0 Table 9-4.
"""
GET_STATUS = 0x00
CLEAR_FEATURE = 0x01
SET_FEATURE = 0x03
SET_ADDRESS = 0x05
GET_DESCRIPTOR = 0x06
SET_DESCRIPTOR = 0x07
GET_CONFIGURATION = 0x08
SET_CONFIGURATION = 0x09
GET_INTERFACE = 0x0A
SET_INTERFACE = 0x0B
SYNCH_FRAME = 0x0C
SET_SEL = 0x30
SET_ISOCH_DELAY = 0x31
class Speed(object):
UNKNOWN = 0
LOW = 1
FULL = 2
HIGH = 3
WIRELESS = 4
SUPER = 5
class VendorID(object):
GOOGLE = 0x18D1
class ProductID(object):
GOOGLE_TEST_GADGET = 0x58F0
GOOGLE_KEYBOARD_GADGET = 0x58F1
GOOGLE_MOUSE_GADGET = 0x58F2
GOOGLE_HID_ECHO_GADGET = 0x58F3
GOOGLE_ECHO_GADGET = 0x58F4