2323DEFAULT_HID_DEVICES = 'KEYBOARD,MOUSE,CONSUMER,GAMEPAD'
2424
2525parser = argparse .ArgumentParser (description = 'Generate USB descriptors.' )
26+ parser .add_argument ('--highspeed' , default = False , action = 'store_true' ,
27+ help = 'descriptor for highspeed device' )
2628parser .add_argument ('--manufacturer' , type = str ,
2729 help = 'manufacturer of the device' )
2830parser .add_argument ('--product' , type = str ,
4042parser .add_argument ('--interface_name' , type = str ,
4143 help = 'The name/prefix to use in the interface descriptions' ,
4244 default = DEFAULT_INTERFACE_NAME )
43- parser .add_argument ('--msc_max_packet_size' , type = int , default = 64 ,
44- help = 'Max packet size for MSC' )
4545parser .add_argument ('--no-renumber_endpoints' , dest = 'renumber_endpoints' , action = 'store_false' ,
4646 help = 'use to not renumber endpoint' )
4747parser .add_argument ('--cdc_ep_num_notification' , type = int , default = 0 ,
@@ -185,11 +185,15 @@ def strings_in_order(cls):
185185 standard .EndpointDescriptor (
186186 description = "CDC data out" ,
187187 bEndpointAddress = args .cdc_ep_num_data_out | standard .EndpointDescriptor .DIRECTION_OUT ,
188- bmAttributes = standard .EndpointDescriptor .TYPE_BULK ),
188+ bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
189+ bInterval = 0 ,
190+ wMaxPacketSize = 512 if args .highspeed else 64 ),
189191 standard .EndpointDescriptor (
190192 description = "CDC data in" ,
191193 bEndpointAddress = args .cdc_ep_num_data_in | standard .EndpointDescriptor .DIRECTION_IN ,
192- bmAttributes = standard .EndpointDescriptor .TYPE_BULK ),
194+ bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
195+ bInterval = 0 ,
196+ wMaxPacketSize = 512 if args .highspeed else 64 ),
193197 ])
194198
195199cdc_interfaces = [cdc_comm_interface , cdc_data_interface ]
@@ -207,13 +211,13 @@ def strings_in_order(cls):
207211 bEndpointAddress = args .msc_ep_num_in | standard .EndpointDescriptor .DIRECTION_IN ,
208212 bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
209213 bInterval = 0 ,
210- wMaxPacketSize = args .msc_max_packet_size ),
214+ wMaxPacketSize = 512 if args .highspeed else 64 ),
211215 standard .EndpointDescriptor (
212216 description = "MSC out" ,
213217 bEndpointAddress = (args .msc_ep_num_out | standard .EndpointDescriptor .DIRECTION_OUT ),
214218 bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
215219 bInterval = 0 ,
216- wMaxPacketSize = args .msc_max_packet_size )
220+ wMaxPacketSize = 512 if args .highspeed else 64 ),
217221 ]
218222 )
219223]
0 commit comments