termios: Fix wrong ECHO flag
Follow https://github.com/apache/nuttx/pull/8800 Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
fc1045271a
commit
ea4437fc76
@ -204,7 +204,7 @@ int nsh_login(FAR struct console_stdio_s *pstate)
|
|||||||
{
|
{
|
||||||
if (tcgetattr(INFD(pstate), &cfg) == 0)
|
if (tcgetattr(INFD(pstate), &cfg) == 0)
|
||||||
{
|
{
|
||||||
cfg.c_iflag &= ~ECHO;
|
cfg.c_lflag &= ~ECHO;
|
||||||
tcsetattr(INFD(pstate), TCSANOW, &cfg);
|
tcsetattr(INFD(pstate), TCSANOW, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ int nsh_login(FAR struct console_stdio_s *pstate)
|
|||||||
{
|
{
|
||||||
if (tcgetattr(INFD(pstate), &cfg) == 0)
|
if (tcgetattr(INFD(pstate), &cfg) == 0)
|
||||||
{
|
{
|
||||||
cfg.c_iflag |= ECHO;
|
cfg.c_lflag |= ECHO;
|
||||||
tcsetattr(INFD(pstate), TCSANOW, &cfg);
|
tcsetattr(INFD(pstate), TCSANOW, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ struct tcurses_vt100_s
|
|||||||
int keycount;
|
int keycount;
|
||||||
char keybuf[16];
|
char keybuf[16];
|
||||||
#ifdef CONFIG_SERIAL_TERMIOS
|
#ifdef CONFIG_SERIAL_TERMIOS
|
||||||
tcflag_t iflag;
|
tcflag_t lflag;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1497,13 +1497,13 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
|
|||||||
{
|
{
|
||||||
/* Save current iflags */
|
/* Save current iflags */
|
||||||
|
|
||||||
priv->iflag = cfg.c_iflag;
|
priv->lflag = cfg.c_lflag;
|
||||||
|
|
||||||
/* If ECHO enabled, disable it */
|
/* If ECHO enabled, disable it */
|
||||||
|
|
||||||
if (cfg.c_iflag & ECHO)
|
if (cfg.c_lflag & ECHO)
|
||||||
{
|
{
|
||||||
cfg.c_iflag &= ~ECHO;
|
cfg.c_lflag &= ~ECHO;
|
||||||
tcsetattr(priv->in_fd, TCSANOW, &cfg);
|
tcsetattr(priv->in_fd, TCSANOW, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1513,7 +1513,7 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
|
|||||||
* tcurses_vt100_terminate
|
* tcurses_vt100_terminate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
priv->iflag = 0;
|
priv->lflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1549,9 +1549,9 @@ static int tcurses_vt100_terminate(FAR struct termcurses_s *dev)
|
|||||||
#ifdef CONFIG_SERIAL_TERMIOS
|
#ifdef CONFIG_SERIAL_TERMIOS
|
||||||
if (isatty(priv->in_fd))
|
if (isatty(priv->in_fd))
|
||||||
{
|
{
|
||||||
if (tcgetattr(priv->in_fd, &cfg) == 0 && priv->iflag & ECHO)
|
if (tcgetattr(priv->in_fd, &cfg) == 0 && priv->lflag & ECHO)
|
||||||
{
|
{
|
||||||
cfg.c_iflag |= ECHO;
|
cfg.c_lflag |= ECHO;
|
||||||
tcsetattr(priv->in_fd, TCSANOW, &cfg);
|
tcsetattr(priv->in_fd, TCSANOW, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user