diff --git a/nshlib/Kconfig b/nshlib/Kconfig index 196af77a1..2ecefc6d7 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -70,6 +70,12 @@ config NSH_PROMPT_STRING ---help--- Provide the shell prompt string, default is "nsh> ". +config NSH_DISABLE_ECHOBACK + bool "Disable echoback" + default n + ---help--- + If this option is selected, the NSH disables echoback. + choice prompt "Command Line Editor" default NSH_READLINE if DEFAULT_SMALL diff --git a/nshlib/nsh_session.c b/nshlib/nsh_session.c index 4e5621552..4c254ddde 100644 --- a/nshlib/nsh_session.c +++ b/nshlib/nsh_session.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef CONFIG_NSH_CLE # include "system/cle.h" @@ -169,6 +170,21 @@ int nsh_session(FAR struct console_stdio_s *pstate, } } +#ifdef CONFIG_NSH_DISABLE_ECHOBACK + /* Disable echoback */ + + if (isatty(INFD(pstate))) + { + struct termios cfg; + + if (tcgetattr(INFD(pstate), &cfg) == 0) + { + cfg.c_lflag &= ~ECHO; + tcsetattr(INFD(pstate), TCSANOW, &cfg); + } + } +#endif + /* Then enter the command line parsing loop */ for (; ; )