diff --git a/include/shell/shell.h b/include/shell/shell.h index 47087714954..5352977ff17 100644 --- a/include/shell/shell.h +++ b/include/shell/shell.h @@ -365,9 +365,6 @@ struct shell { LOG_INSTANCE_PTR_DECLARE(log); - /*!< New line character, only allowed values: \\n and \\r.*/ - const char newline_char; - struct k_thread *thread; k_thread_stack_t *stack; }; @@ -378,12 +375,10 @@ struct shell { * @param[in] _name Instance name. * @param[in] _prompt Shell prompt string. * @param[in] transport_iface Pointer to the transport interface. - * @param[in] newline_ch New line character - only allowed values are - * '\\n' or '\\r'. * @param[in] log_queue_size Logger processing queue size. */ #define SHELL_DEFINE(_name, _prompt, transport_iface, \ - newline_ch, log_queue_size) \ + log_queue_size) \ static const struct shell _name; \ static struct shell_ctx UTIL_CAT(_name, _ctx); \ static char _name##prompt[CONFIG_SHELL_PROMPT_LENGTH + 1] = _prompt; \ @@ -407,7 +402,6 @@ struct shell { .stats = SHELL_STATS_PTR(_name), \ .log_backend = SHELL_LOG_BACKEND_PTR(_name), \ LOG_INSTANCE_PTR_INIT(log, shell, _name) \ - .newline_char = newline_ch, \ .thread = &_name##_thread, \ .stack = _name##_stack \ } diff --git a/samples/subsys/shell/shell_module/src/main.c b/samples/subsys/shell/shell_module/src/main.c index f4a55f10f02..f0a463a6b9d 100644 --- a/samples/subsys/shell/shell_module/src/main.c +++ b/samples/subsys/shell/shell_module/src/main.c @@ -15,7 +15,7 @@ LOG_MODULE_REGISTER(app); SHELL_UART_DEFINE(shell_transport_uart); -SHELL_DEFINE(uart_shell, "uart:~$ ", &shell_transport_uart, '\r', 10); +SHELL_DEFINE(uart_shell, "uart:~$ ", &shell_transport_uart, 10); extern void foo(void); diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index 172c740926e..cb0a8e04ca0 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -759,8 +759,7 @@ static void shell_state_collect(const struct shell *shell) switch (shell->ctx->receive_state) { case SHELL_RECEIVE_DEFAULT: - if (data == shell->newline_char) { - + if ((data == '\r') || (data == '\n')) { if (!shell->ctx->cmd_buff_len) { history_mode_exit(shell); cursor_next_line_move(shell); @@ -1150,8 +1149,6 @@ static int shell_instance_init(const struct shell *shell, const void *p_config, { __ASSERT_NO_MSG(shell); __ASSERT_NO_MSG(shell->ctx && shell->iface && shell->prompt); - __ASSERT_NO_MSG((shell->newline_char == '\n') || - (shell->newline_char == '\r')); int err; diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index e6b7bed7f3d..dfc1fc7faef 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -29,7 +29,7 @@ #define DEVICE_NAME CONFIG_BT_DEVICE_NAME SHELL_UART_DEFINE(shell_transport_uart); -SHELL_DEFINE(uart_shell, "uart:~$ ", &shell_transport_uart, '\r', 10); +SHELL_DEFINE(uart_shell, "uart:~$ ", &shell_transport_uart, 10); #if defined(CONFIG_BT_CONN) static bool hrs_simulate;