From 3b49ed46df0cfb3de8f35593f2faef131122fbc2 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 18 May 2021 14:40:15 +0000 Subject: [PATCH] shell: Parametrize dummy shell buffer size The commit adds Kconfig option to configure dummy shell buffer size. Size of this buffer determines how mutch of command output will be stored in buffer. Signed-off-by: Dominik Ermel --- include/shell/shell_dummy.h | 2 +- subsys/shell/Kconfig.backends | 12 +++++++++++- subsys/shell/shell.c | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/shell/shell_dummy.h b/include/shell/shell_dummy.h index e2af17fcd91..7d970121099 100644 --- a/include/shell/shell_dummy.h +++ b/include/shell/shell_dummy.h @@ -24,7 +24,7 @@ struct shell_dummy { size_t len; /** output buffer to collect shell output */ - char buf[300]; + char buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE]; }; #define SHELL_DUMMY_DEFINE(_name) \ diff --git a/subsys/shell/Kconfig.backends b/subsys/shell/Kconfig.backends index dcdee1761d6..076aa2d4052 100644 --- a/subsys/shell/Kconfig.backends +++ b/subsys/shell/Kconfig.backends @@ -291,11 +291,21 @@ config SHELL_BACKEND_DUMMY Enable dummy backend which can be used to execute commands with no need for physical transport interface. +if SHELL_BACKEND_DUMMY + config SHELL_PROMPT_DUMMY string "Displayed prompt name" - depends on SHELL_BACKEND_DUMMY default "~$ " help Displayed prompt name for DUMMY backend. +config SHELL_BACKEND_DUMMY_BUF_SIZE + int "Size of dummy buffer size" + default 300 + help + This is size of output buffer that will be used by dummy backend, this limits number of + characters that will be captured from command output. + +endif # SHELL_BACKEND_DUMMY + endif # SHELL_BACKENDS diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index 5237d76e1e7..e58f5bd0098 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -8,7 +8,9 @@ #include #include #include +#if defined(CONFIG_SHELL_BACKEND_DUMMY) #include +#endif #include "shell_ops.h" #include "shell_help.h" #include "shell_utils.h"