23
23
DEFAULT_HID_DEVICES = 'KEYBOARD,MOUSE,CONSUMER,GAMEPAD'
24
24
25
25
parser = argparse .ArgumentParser (description = 'Generate USB descriptors.' )
26
+ parser .add_argument ('--highspeed' , default = False , action = 'store_true' ,
27
+ help = 'descriptor for highspeed device' )
26
28
parser .add_argument ('--manufacturer' , type = str ,
27
29
help = 'manufacturer of the device' )
28
30
parser .add_argument ('--product' , type = str ,
40
42
parser .add_argument ('--interface_name' , type = str ,
41
43
help = 'The name/prefix to use in the interface descriptions' ,
42
44
default = DEFAULT_INTERFACE_NAME )
43
- parser .add_argument ('--msc_max_packet_size' , type = int , default = 64 ,
44
- help = 'Max packet size for MSC' )
45
45
parser .add_argument ('--no-renumber_endpoints' , dest = 'renumber_endpoints' , action = 'store_false' ,
46
46
help = 'use to not renumber endpoint' )
47
47
parser .add_argument ('--cdc_ep_num_notification' , type = int , default = 0 ,
@@ -185,11 +185,15 @@ def strings_in_order(cls):
185
185
standard .EndpointDescriptor (
186
186
description = "CDC data out" ,
187
187
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 ),
189
191
standard .EndpointDescriptor (
190
192
description = "CDC data in" ,
191
193
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 ),
193
197
])
194
198
195
199
cdc_interfaces = [cdc_comm_interface , cdc_data_interface ]
@@ -207,13 +211,13 @@ def strings_in_order(cls):
207
211
bEndpointAddress = args .msc_ep_num_in | standard .EndpointDescriptor .DIRECTION_IN ,
208
212
bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
209
213
bInterval = 0 ,
210
- wMaxPacketSize = args .msc_max_packet_size ),
214
+ wMaxPacketSize = 512 if args .highspeed else 64 ),
211
215
standard .EndpointDescriptor (
212
216
description = "MSC out" ,
213
217
bEndpointAddress = (args .msc_ep_num_out | standard .EndpointDescriptor .DIRECTION_OUT ),
214
218
bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
215
219
bInterval = 0 ,
216
- wMaxPacketSize = args .msc_max_packet_size )
220
+ wMaxPacketSize = 512 if args .highspeed else 64 ),
217
221
]
218
222
)
219
223
]
0 commit comments