@@ -323,13 +323,16 @@ def strings_in_order(cls):
323323 standard .EndpointDescriptor (
324324 description = "MIDI data out to {}" .format (args .interface_name ),
325325 bEndpointAddress = args .midi_ep_num_out | standard .EndpointDescriptor .DIRECTION_OUT ,
326- bmAttributes = standard .EndpointDescriptor .TYPE_BULK ),
326+ bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
327+ bInterval = 0 ,
328+ wMaxPacketSize = 512 if args .highspeed else 64 ),
327329 midi .DataEndpointDescriptor (baAssocJack = [midi_in_jack_emb ]),
328330 standard .EndpointDescriptor (
329331 description = "MIDI data in from {}" .format (args .interface_name ),
330332 bEndpointAddress = args .midi_ep_num_in | standard .EndpointDescriptor .DIRECTION_IN ,
331333 bmAttributes = standard .EndpointDescriptor .TYPE_BULK ,
332- bInterval = 0x0 ),
334+ bInterval = 0x0 ,
335+ wMaxPacketSize = 512 if args .highspeed else 64 ),
333336 midi .DataEndpointDescriptor (baAssocJack = [midi_out_jack_emb ]),
334337 ])
335338
@@ -544,15 +547,15 @@ def strings_in_order(cls):
544547#include <stdint.h>
545548
546549extern const uint8_t usb_desc_dev[{device_length}];
547- // Make sure the control buffer is big enough to fit the descriptor.
548- #define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length}
549550extern const uint8_t usb_desc_cfg[{configuration_length}];
550551extern uint16_t usb_serial_number[{serial_number_length}];
551552extern uint16_t const * const string_desc_arr [{string_descriptor_length}];
552553
553554extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
554555
555- #define USB_HID_NUM_DEVICES {hid_num_devices}
556+ #define CFG_TUSB_RHPORT0_MODE ({rhport0_mode})
557+
558+ #define USB_HID_NUM_DEVICES {hid_num_devices}
556559
557560// Vendor name included in Inquiry response, max 8 bytes
558561#define CFG_TUD_MSC_VENDOR "{msc_vendor}"
@@ -567,6 +570,7 @@ def strings_in_order(cls):
567570 max_configuration_length = max (hid_descriptor_length , descriptor_length ),
568571 string_descriptor_length = len (pointers_to_strings ),
569572 hid_report_descriptor_length = len (bytes (combined_hid_report_descriptor )),
573+ rhport0_mode = 'OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED' if args .highspeed else 'OPT_MODE_DEVICE' ,
570574 hid_num_devices = len (args .hid_devices ),
571575 msc_vendor = args .manufacturer [:8 ],
572576 msc_product = args .product [:16 ]))
0 commit comments