From 755fbd31698714d99c9dde850439f69dc6cca2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Iglesias=20Paredes?= <40626818+igparaul@users.noreply.github.com> Date: Fri, 24 Apr 2026 15:16:31 +0200 Subject: [PATCH] Avoiding crashing while building without console. --- .../components/btstack/btstack_stdio_esp32.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/port/esp32/components/btstack/btstack_stdio_esp32.c b/port/esp32/components/btstack/btstack_stdio_esp32.c index aa43e1abf8..a572ef3fd1 100644 --- a/port/esp32/components/btstack/btstack_stdio_esp32.c +++ b/port/esp32/components/btstack/btstack_stdio_esp32.c @@ -99,6 +99,9 @@ static btstack_context_callback_registration_t stdio_callback_context = { .context = NULL, }; +#ifdef CONFIG_ESP_CONSOLE_UART +/* UART Implementation */ + void btstack_stdin_setup(void (*handler)(char c)){ if (btstack_stdio_initialized == false){ ESP_LOGE(TAG, "to enable support for console input, call btstack_stdio_init first"); @@ -107,9 +110,6 @@ void btstack_stdin_setup(void (*handler)(char c)){ stdin_handler = handler; } -#ifdef CONFIG_ESP_CONSOLE_UART -/* UART Implementation */ - #include "driver/uart.h" static QueueHandle_t uart_queue = NULL; @@ -233,6 +233,14 @@ void btstack_stdio_init(void) { #elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG +void btstack_stdin_setup(void (*handler)(char c)){ + if (btstack_stdio_initialized == false){ + ESP_LOGE(TAG, "to enable support for console input, call btstack_stdio_init first"); + } + // set handler + stdin_handler = handler; +} + /* USB JTAG/Serial Implementation */ #include "driver/usb_serial_jtag.h" @@ -284,6 +292,9 @@ void btstack_stdio_init(void) { #else // Empty functions for backwards-compatibility +static void btstack_stdio_process(void *context){ + UNUSED(context); +} void btstack_stdio_init(void) {} void btstack_stdin_setup(void (*handler)(char c)){ (void) handler;