Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: tools/usb_gadget/usb_const.py

Issue 409883008: [usb_gadget p00] Classes for encoding USB descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tools/usb_gadget/descriptor.py ('K') | « tools/usb_gadget/descriptor_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/usb_gadget/usb_const.py
diff --git a/tools/usb_gadget/usb_const.py b/tools/usb_gadget/usb_const.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ec09b93cd9cbb31912bcee7a74427597e465602
--- /dev/null
+++ b/tools/usb_gadget/usb_const.py
@@ -0,0 +1,111 @@
+"""USB constant definitions.
+"""
+
+
+class DescriptorType(object):
+ DEVICE = 1
+ CONFIGURATION = 2
+ STRING = 3
+ INTERFACE = 4
+ ENDPOINT = 5
+ QUALIFIER = 6
+ OTHER_SPEED_CONFIGURATION = 7
+
+
+class DeviceClass(object):
+ """USB device classes."""
+ 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):
+ PER_INTERFACE = 0
+ VENDOR = 0xFF
+
+
+class DeviceProtocol(object):
+ PER_INTERFACE = 0
+ VENDOR = 0xFF
+
+
+class InterfaceClass(object):
+ VENDOR = 0xFF
+
+
+class InterfaceSubClass(object):
+ VENDOR = 0xFF
+
+
+class InterfaceProtocol(object):
+ VENDOR = 0xFF
+
+
+class TransferType(object):
+ MASK = 3
+ CONTROL = 0
+ ISOCHRONOUS = 1
+ BULK = 2
+ INTERRUPT = 3
+
+
+class Dir(object):
+ OUT = 0
+ IN = 0x80
+
+
+class Type(object):
+ MASK = 0x60
+ STANDARD = 0x00
+ CLASS = 0x20
+ VENDOR = 0x40
+ RESERVED = 0x60
+
+
+class Recipient(object):
+ MASK = 0x1f
+ DEVICE = 0
+ INTERFACE = 1
+ ENDPOINT = 2
+ OTHER = 3
+
+
+class Request(object):
+ """Standard USB control request types."""
+ 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
« tools/usb_gadget/descriptor.py ('K') | « tools/usb_gadget/descriptor_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698