You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/07 13:10:55 UTC

[incubator-nuttx] 06/07: Trigger SGA and ECHO proactively in the character mode

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

gnutt pushed a commit to branch pr215
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 526fa7b77359c38ac21d2856c7f5d3baf365ec08
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Feb 5 23:52:37 2020 +0800

    Trigger SGA and ECHO proactively in the character mode
    
    otherwise Ubuntu bultin telnet can't enter this mode
    
    Change-Id: I8aa2ab2b31c35007077c701c264b3971152435f0
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/net/telnet.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 6ab3ab2..d5a980c 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -466,19 +466,9 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv,
 
           case STATE_DO:
 #ifdef CONFIG_TELNET_CHARACTER_MODE
-            if (ch == TELNET_SGA)
+            if (ch == TELNET_SGA || ch == TELNET_ECHO)
               {
-                /* If it received 'Suppress Go Ahead', reply with a WILL */
-
-                telnet_sendopt(priv, TELNET_WILL, ch);
-
-                /* Also, send 'WILL ECHO' */
-
-                telnet_sendopt(priv, TELNET_WILL, TELNET_ECHO);
-              }
-            else if (ch == TELNET_ECHO)
-              {
-                /* If it received 'ECHO', then do nothing */
+                /* If it received 'ECHO' or 'Suppress Go Ahead', then do nothing */
               }
             else
               {
@@ -1108,6 +1098,11 @@ static int telnet_session(FAR struct telnet_session_s *session)
   telnet_sendopt(priv, TELNET_DO, TELNET_NAWS);
 #endif
 
+#ifdef CONFIG_TELNET_CHARACTER_MODE
+  telnet_sendopt(priv, TELNET_WILL, TELNET_SGA);
+  telnet_sendopt(priv, TELNET_WILL, TELNET_ECHO);
+#endif
+
   /* Has the I/O thread been started? */
 
   if (g_telnet_io_kthread == (pid_t)0)