From 6ba720d126672937f9c8c4604f073d83a3459d42 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 23 Sep 2025 22:21:44 -0500 Subject: [PATCH] ato --- esphome/components/usb_uart/usb_uart.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/usb_uart/usb_uart.cpp b/esphome/components/usb_uart/usb_uart.cpp index 5ad86037ed..c6a0e56adc 100644 --- a/esphome/components/usb_uart/usb_uart.cpp +++ b/esphome/components/usb_uart/usb_uart.cpp @@ -266,6 +266,9 @@ void USBUartComponent::start_input(USBUartChannel *channel) { } void USBUartComponent::start_output(USBUartChannel *channel) { + // IMPORTANT: This function must only be called from the main loop! + // The output_buffer_ is not thread-safe and can only be accessed from main loop. + // USB callbacks use defer() to ensure this function runs in the correct context. if (channel->output_started_.load()) return; if (channel->output_buffer_.is_empty()) {