mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:45:15 +00:00
[tinyusb] Reject logger.hardware_uart: USB_CDC (#16417)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ from esphome.components.esp32 import (
|
|||||||
add_idf_sdkconfig_option,
|
add_idf_sdkconfig_option,
|
||||||
)
|
)
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_HARDWARE_UART, CONF_ID
|
||||||
|
|
||||||
CODEOWNERS = ["@kbx81"]
|
CODEOWNERS = ["@kbx81"]
|
||||||
CONFLICTS_WITH = ["usb_host"]
|
CONFLICTS_WITH = ["usb_host"]
|
||||||
@@ -55,6 +55,17 @@ def _final_validate(config):
|
|||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
"The 'tinyusb' component requires at least one USB class component"
|
"The 'tinyusb' component requires at least one USB class component"
|
||||||
)
|
)
|
||||||
|
# tinyusb owns the USB OTG peripheral. The logger's USB_CDC backend routes
|
||||||
|
# the ROM console through that same peripheral, so the two cannot coexist.
|
||||||
|
# (USB_SERIAL_JTAG is a separate peripheral and is fine alongside tinyusb.)
|
||||||
|
logger_config = full_config.get("logger")
|
||||||
|
if logger_config and logger_config.get(CONF_HARDWARE_UART) == "USB_CDC":
|
||||||
|
raise cv.Invalid(
|
||||||
|
"'tinyusb' cannot be used with 'logger.hardware_uart: USB_CDC' "
|
||||||
|
"because both share the USB OTG peripheral. Set "
|
||||||
|
"'logger.hardware_uart' to a hardware UART (e.g. UART0), or to "
|
||||||
|
"USB_SERIAL_JTAG on variants that support it (ESP32-S3, ESP32-P4)"
|
||||||
|
)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,6 @@
|
|||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
|
||||||
|
# S2 defaults logger to USB_CDC, which conflicts with tinyusb on the shared
|
||||||
|
# USB OTG peripheral; route the logger to UART0 so the fixture builds.
|
||||||
|
logger:
|
||||||
|
hardware_uart: UART0
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<<: !include tinyusb_common.yaml
|
<<: !include tinyusb_common.yaml
|
||||||
|
|
||||||
|
# S2 defaults logger to USB_CDC, which conflicts with tinyusb on the shared
|
||||||
|
# USB OTG peripheral; route the logger to UART0 so the fixture builds.
|
||||||
|
logger:
|
||||||
|
hardware_uart: UART0
|
||||||
|
|
||||||
usb_cdc_acm:
|
usb_cdc_acm:
|
||||||
interfaces:
|
interfaces:
|
||||||
- id: usb_cdc_acm1
|
- id: usb_cdc_acm1
|
||||||
|
|||||||
Reference in New Issue
Block a user