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 <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2021-05-18 14:40:15 +00:00 committed by Anas Nashif
commit 3b49ed46df
3 changed files with 14 additions and 2 deletions

View file

@ -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) \

View file

@ -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

View file

@ -8,7 +8,9 @@
#include <stdlib.h>
#include <sys/atomic.h>
#include <shell/shell.h>
#if defined(CONFIG_SHELL_BACKEND_DUMMY)
#include <shell/shell_dummy.h>
#endif
#include "shell_ops.h"
#include "shell_help.h"
#include "shell_utils.h"