This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new ea4437fc7 termios: Fix wrong ECHO flag
ea4437fc7 is described below

commit ea4437fc7623def76fb9984029afbe391e8d9bd6
Author: Huang Qi <[email protected]>
AuthorDate: Mon Mar 13 17:23:34 2023 +0800

    termios: Fix wrong ECHO flag
    
    Follow https://github.com/apache/nuttx/pull/8800
    
    Signed-off-by: Huang Qi <[email protected]>
---
 nshlib/nsh_login.c                |  4 ++--
 system/termcurses/tcurses_vt100.c | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/nshlib/nsh_login.c b/nshlib/nsh_login.c
index c1feb0d54..20cd6dc45 100644
--- a/nshlib/nsh_login.c
+++ b/nshlib/nsh_login.c
@@ -204,7 +204,7 @@ int nsh_login(FAR struct console_stdio_s *pstate)
         {
           if (tcgetattr(INFD(pstate), &cfg) == 0)
             {
-              cfg.c_iflag &= ~ECHO;
+              cfg.c_lflag &= ~ECHO;
               tcsetattr(INFD(pstate), TCSANOW, &cfg);
             }
         }
@@ -221,7 +221,7 @@ int nsh_login(FAR struct console_stdio_s *pstate)
         {
           if (tcgetattr(INFD(pstate), &cfg) == 0)
             {
-              cfg.c_iflag |= ECHO;
+              cfg.c_lflag |= ECHO;
               tcsetattr(INFD(pstate), TCSANOW, &cfg);
             }
         }
diff --git a/system/termcurses/tcurses_vt100.c 
b/system/termcurses/tcurses_vt100.c
index ed8ec278c..3f36f9d84 100644
--- a/system/termcurses/tcurses_vt100.c
+++ b/system/termcurses/tcurses_vt100.c
@@ -76,7 +76,7 @@ struct tcurses_vt100_s
   int    keycount;
   char   keybuf[16];
 #ifdef CONFIG_SERIAL_TERMIOS
-  tcflag_t iflag;
+  tcflag_t lflag;
 #endif
 };
 
@@ -1497,13 +1497,13 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int 
in_fd, int out_fd)
             {
               /* Save current iflags */
 
-              priv->iflag = cfg.c_iflag;
+              priv->lflag = cfg.c_lflag;
 
               /* 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);
                 }
             }
@@ -1513,7 +1513,7 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int 
in_fd, int out_fd)
                * tcurses_vt100_terminate
                */
 
-              priv->iflag = 0;
+              priv->lflag = 0;
             }
         }
 #endif
@@ -1549,9 +1549,9 @@ static int tcurses_vt100_terminate(FAR struct 
termcurses_s *dev)
 #ifdef CONFIG_SERIAL_TERMIOS
       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);
             }
         }

Reply via email to