3 # Contains definition of USB class, which is just a container for a bunch of
4 # constants/enums associated with the USB protocol.
6 # TODO: would be nice if this module could re-export the other USB* classes so
7 # one need import only USB to get all the functionality
18 request_direction_host_to_device = 0
19 request_direction_device_to_host = 1
21 request_type_standard = 0
22 request_type_class = 1
23 request_type_vendor = 2
25 request_recipient_device = 0
26 request_recipient_interface = 1
27 request_recipient_endpoint = 2
28 request_recipient_other = 3
30 feature_endpoint_halt = 0
31 feature_device_remote_wakeup = 1
35 desc_type_configuration = 2
37 desc_type_interface = 4
38 desc_type_endpoint = 5
39 desc_type_device_qualifier = 6
40 desc_type_other_speed_configuration = 7
41 desc_type_interface_power = 8
45 # while this holds for HID, it may not be a correct model for the USB
47 if_class_to_desc_type = {
51 def interface_class_to_descriptor_type(interface_class):
52 return USB.if_class_to_desc_type[interface_class]