Skip to content

Commit 40fe144

Browse files
authored
Merge pull request #7 from adafruit/fix-usb-v4.2
temporarily walkaround for tinyusb init for v4.2
2 parents 961b038 + d3468d3 commit 40fe144

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: cores/esp32/esp32-hal-tinyusb.c

+11
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,22 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) {
536536
tinyusb_config_t tusb_cfg = {
537537
.external_phy = false // In the most cases you need to use a `false` value
538538
};
539+
539540
esp_err_t err = tinyusb_driver_install(&tusb_cfg);
541+
542+
#if 1 // walkaround for v4.2 tinyusb init bug
543+
// Note: IDF v4.2 has a bug that incorrectly check the tusb_init() returned value (bool instead of error code)
544+
// https://github.com/espressif/esp-idf/blob/release/v4.2/components/tinyusb/port/esp32s2/src/tinyusb.c#L89
545+
// This is due to a internal bug of tinyusb stack which is fixed recently.
546+
// This is fixed in IDF v4.3 and should be reverted when 4.3 is released
547+
err = ESP_OK;
548+
#endif
549+
540550
if (err != ESP_OK) {
541551
initialized = false;
542552
return err;
543553
}
554+
544555
xTaskCreate(usb_device_task, "usbd", 4096, NULL, configMAX_PRIORITIES - 1, NULL);
545556
return err;
546557
}

0 commit comments

Comments
 (0)