From c09edb94c1984add3e28fcbe56003800d588ae15 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Mon, 16 Mar 2026 00:04:07 -0500 Subject: [PATCH] [tinyusb] Fix regression from bump to 2.x in #14796 (#14848) --- .../components/tinyusb/tinyusb_component.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/esphome/components/tinyusb/tinyusb_component.cpp b/esphome/components/tinyusb/tinyusb_component.cpp index 7f8fea5264..2ec696c3e4 100644 --- a/esphome/components/tinyusb/tinyusb_component.cpp +++ b/esphome/components/tinyusb/tinyusb_component.cpp @@ -2,6 +2,7 @@ #include "tinyusb_component.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" +#include "tinyusb_default_config.h" namespace esphome::tinyusb { @@ -15,19 +16,19 @@ void TinyUSB::setup() { this->string_descriptor_[SERIAL_NUMBER] = mac_addr_buf; } - this->tusb_cfg_ = { - .port = TINYUSB_PORT_FULL_SPEED_0, - .phy = {.skip_setup = false}, - .descriptor = - { - .device = &this->usb_descriptor_, - .string = this->string_descriptor_, - .string_count = SIZE, - }, + // Start from esp_tinyusb defaults to keep required task settings valid across esp_tinyusb updates. + this->tusb_cfg_ = TINYUSB_DEFAULT_CONFIG(); + this->tusb_cfg_.port = TINYUSB_PORT_FULL_SPEED_0; + this->tusb_cfg_.phy.skip_setup = false; + this->tusb_cfg_.descriptor = { + .device = &this->usb_descriptor_, + .string = this->string_descriptor_, + .string_count = SIZE, }; esp_err_t result = tinyusb_driver_install(&this->tusb_cfg_); if (result != ESP_OK) { + ESP_LOGE(TAG, "tinyusb_driver_install failed: %s", esp_err_to_name(result)); this->mark_failed(); } }