From 6be0b2f1b8442bdf741c9d835d73ceea23aa8c92 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 5 Feb 2020 23:52:37 +0800 Subject: [PATCH] drivers/net/telnet.c: Trigger SGA and ECHO proactively in the character mode Trigger SGA and ECHO proactively in character mode otherwise Ubuntu bultin telnet can't enter this mode Change-Id: I8aa2ab2b31c35007077c701c264b3971152435f0 Signed-off-by: Xiang Xiao --- 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 6ab3ab2d01..d5a980c71b 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)