From 0370a3061df5da7fe24dfe1f1513c28ee98f0e5d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 23 Sep 2025 21:41:48 -0500 Subject: [PATCH] fix --- esphome/components/usb_uart/usb_uart.cpp | 7 ++----- esphome/components/usb_uart/usb_uart.h | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/esphome/components/usb_uart/usb_uart.cpp b/esphome/components/usb_uart/usb_uart.cpp index a872b37fa2..b485397214 100644 --- a/esphome/components/usb_uart/usb_uart.cpp +++ b/esphome/components/usb_uart/usb_uart.cpp @@ -246,11 +246,8 @@ void USBUartComponent::start_input(USBUartChannel *channel) { chunk->channel = channel; // Push to lock-free queue for main loop processing - if (!this->usb_data_queue_.push(chunk)) { - ESP_LOGW(TAG, "USB data queue full, dropping %u bytes", status.data_len); - // Return chunk to pool - this->chunk_pool_.release(chunk); - } + // Push always succeeds because pool size == queue size + this->usb_data_queue_.push(chunk); } // Always restart input immediately from USB task diff --git a/esphome/components/usb_uart/usb_uart.h b/esphome/components/usb_uart/usb_uart.h index 1389ceeaee..aab36c52b5 100644 --- a/esphome/components/usb_uart/usb_uart.h +++ b/esphome/components/usb_uart/usb_uart.h @@ -137,8 +137,8 @@ class USBUartComponent : public usb_host::USBClient { LockFreeQueue usb_data_queue_; // Pool for allocating data chunks (uses EventPool pattern like BLE) - static constexpr int MAX_DATA_CHUNKS = 40; - EventPool chunk_pool_; + // MUST be same size as queue to guarantee push always succeeds after allocate + EventPool chunk_pool_; protected: std::vector channels_{};