fix(console): add ability to unblock linenoise, to fix deadlock

Closes https://github.com/espressif/esp-idf/pull/10580
Closes https://github.com/espressif/esp-idf/issues/9974
This commit is contained in:
Guillaume Souchere
2025-03-05 12:23:08 +01:00
parent 2c990a6933
commit 5b2f2e05f3
7 changed files with 232 additions and 53 deletions
@@ -11,6 +11,7 @@
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp_console.h"
#define CONSOLE_PROMPT_MAX_LEN (32)
@@ -32,6 +33,7 @@ typedef struct {
esp_console_repl_t repl_core; // base class
char prompt[CONSOLE_PROMPT_MAX_LEN]; // Prompt to be printed before each line
repl_state_t state;
SemaphoreHandle_t state_mux;
const char *history_save_path;
TaskHandle_t task_hdl; // REPL task handle
size_t max_cmdline_length; // Maximum length of a command line. If 0, default value will be used.
@@ -49,3 +51,4 @@ esp_err_t esp_console_setup_prompt(const char *prompt, esp_console_repl_com_t *r
esp_err_t esp_console_setup_history(const char *history_path,
uint32_t max_history_len,
esp_console_repl_com_t *repl_com);
esp_err_t esp_console_interrupt_reading(void);