Skip to content

Commit 98a1a15

Browse files
jakub-uCdkalowsk
authored andcommitted
shell: add Kconfig option for configurable autoflush behavior
Introduced a new Kconfig option `SHELL_PRINTF_AUTOFLUSH` to allow configuring the autoflush behavior of shell printing functions. Updated `Z_SHELL_FPRINTF_DEFINE` to use the `CONFIG_SHELL_PRINTF_AUTOFLUSH` setting instead of hardcoding the autoflush behavior to `true`. Signed-off-by: Jakub Rzeszutko <[email protected]> (cherry picked from commit 8991b95)
1 parent 5fe9a7e commit 98a1a15

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/zephyr/shell/shell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ extern void z_shell_print_stream(const void *user_ctx, const char *data,
930930
static struct shell_ctx UTIL_CAT(_name, _ctx); \
931931
Z_SHELL_HISTORY_DEFINE(_name##_history, CONFIG_SHELL_HISTORY_BUFFER); \
932932
Z_SHELL_FPRINTF_DEFINE(_name##_fprintf, &_name, _out_buf, CONFIG_SHELL_PRINTF_BUFF_SIZE, \
933-
true, z_shell_print_stream); \
933+
IS_ENABLED(CONFIG_SHELL_PRINTF_AUTOFLUSH), z_shell_print_stream); \
934934
LOG_INSTANCE_REGISTER(shell, _name, CONFIG_SHELL_LOG_LEVEL); \
935935
Z_SHELL_STATS_DEFINE(_name); \
936936
static K_KERNEL_STACK_DEFINE(_name##_stack, CONFIG_SHELL_STACK_SIZE); \

subsys/shell/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ config SHELL_PRINTF_BUFF_SIZE
8989
It is working like stdio buffering in Linux systems
9090
to limit number of peripheral access calls.
9191

92+
config SHELL_PRINTF_AUTOFLUSH
93+
bool "Indicate if the buffer should be automatically flushed"
94+
default y
95+
help
96+
Specify whether the shell's printing functions should automatically
97+
flush the printf buffer.
98+
9299
config SHELL_DEFAULT_TERMINAL_WIDTH
93100
int "Default terminal width"
94101
range 1 $(UINT16_MAX)

0 commit comments

Comments
 (0)