From 17c5c9023c26426d1ee0eaefcb3fde5c323a7962 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sun, 16 Mar 2025 14:14:29 +0100 Subject: [PATCH] add some ascii cmd rules --- src/ascii_cmd.c | 4 ++++ src/control_pipe.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/ascii_cmd.c b/src/ascii_cmd.c index 67ef72d..c6ff5d3 100644 --- a/src/ascii_cmd.c +++ b/src/ascii_cmd.c @@ -383,6 +383,10 @@ void process_ascii_cmd(RDSModulator* mod, unsigned char *str) { unsigned char *cmd, *arg; uint16_t cmd_len = _strnlen((const char*)str, CTL_BUFFER_SIZE); + for(uint16_t i = 0; i < cmd_len; i++) { + if(str[i] == '\t') str[i] = ' '; + } + for (size_t i = 0; i < sizeof(commands_exact) / sizeof(command_handler_t); i++) { const command_handler_t *handler = &commands_exact[i]; if (cmd_len == handler->cmd_length && diff --git a/src/control_pipe.c b/src/control_pipe.c index 1afe5b4..699ff7f 100644 --- a/src/control_pipe.c +++ b/src/control_pipe.c @@ -31,6 +31,7 @@ void poll_control_pipe(RDSModulator* mod) { if (bytes_read <= 0) return; token = strtok((char *)pipe_buf, "\n"); + if(token == NULL) token = strtok((char *)pipe_buf, "\x1A"); while (token != NULL) { size_t cmd_len = strlen(token); if (cmd_len > 0 && cmd_len < CMD_BUFFER_SIZE) { @@ -39,6 +40,7 @@ void poll_control_pipe(RDSModulator* mod) { process_ascii_cmd(mod, cmd_buf); } token = strtok(NULL, "\n"); + if(token == NULL) token = strtok(NULL, "\x1A"); } }