@@ -424,12 +424,6 @@ static bool tinyusb_load_enabled_interfaces(){
424424 log_e ("Descriptor Load Failed" );
425425 return false;
426426 } else {
427- if (i == USB_INTERFACE_CDC ){
428- if (!tinyusb_reserve_out_endpoint (3 ) || !tinyusb_reserve_in_endpoint (4 ) || !tinyusb_reserve_in_endpoint (5 )){
429- log_e ("CDC Reserve Endpoints Failed" );
430- return false;
431- }
432- }
433427 dst += len ;
434428 }
435429 }
@@ -505,6 +499,7 @@ static void tinyusb_apply_device_config(tinyusb_device_config_t *config){
505499 && (config -> usb_class != TUSB_CLASS_CDC )
506500 ){
507501 config -> usb_class = TUSB_CLASS_CDC ;
502+ config -> usb_protocol = 0x00 ;
508503 }
509504
510505 WEBUSB_ENABLED = config -> webusb_enabled ;
@@ -573,6 +568,12 @@ esp_err_t tinyusb_enable_interface(tinyusb_interface_t interface, uint16_t descr
573568 log_e ("Interface %s invalid or already enabled" , (interface >= USB_INTERFACE_MAX )?"" :tinyusb_interface_names [interface ]);
574569 return ESP_FAIL ;
575570 }
571+ if (interface == USB_INTERFACE_CDC ){
572+ if (!tinyusb_reserve_out_endpoint (3 ) || !tinyusb_reserve_in_endpoint (4 ) || !tinyusb_reserve_in_endpoint (5 )){
573+ log_e ("CDC Reserve Endpoints Failed" );
574+ return ESP_FAIL ;
575+ }
576+ }
576577 tinyusb_loaded_interfaces_mask |= (1U << interface );
577578 tinyusb_config_descriptor_len += descriptor_len ;
578579 tinyusb_loaded_interfaces_callbacks [interface ] = cb ;
@@ -586,7 +587,7 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) {
586587 }
587588 tinyusb_is_initialized = true;
588589
589- tinyusb_endpoints .val = 0 ;
590+ // tinyusb_endpoints.val = 0;
590591 tinyusb_apply_device_config (config );
591592 if (!tinyusb_load_enabled_interfaces ()) {
592593 tinyusb_is_initialized = false;
0 commit comments