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 <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-02-05 23:52:37 +08:00 committed by Gregory Nutt
parent ed2a002ee5
commit 6be0b2f1b8

View File

@ -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)