From 51dc4c3b1eff31a04e7e9121f5cd9a1dac1789e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 10 Nov 2021 14:49:09 +0100 Subject: [PATCH] shell: telnet: Disable echo When telnet client queries about remote echo support, we reply that we won't do it (which reduces the traffic), however the echo was not actually disabled on the shell. In result characters were double-echoed in the character mode (by both local echo from the client and remote echo from the server). Signed-off-by: Robert Lubos --- subsys/shell/backends/shell_telnet.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subsys/shell/backends/shell_telnet.c b/subsys/shell/backends/shell_telnet.c index c2bcada140f..947e5fcab44 100644 --- a/subsys/shell/backends/shell_telnet.c +++ b/subsys/shell/backends/shell_telnet.c @@ -248,6 +248,8 @@ static void telnet_accept(struct net_context *client, int error, void *user_data) { + int ret; + if (error) { LOG_ERR("Error %d", error); goto error; @@ -271,6 +273,14 @@ static void telnet_accept(struct net_context *client, sh_telnet->client_ctx = client; + /* Disable echo - if command handling is enabled we reply that we don't + * support echo. + */ + ret = shell_echo_set(sh_telnet->shell_context, false); + if (ret < 0) { + LOG_ERR("Failed to disable echo, err: %d", ret); + } + return; error: net_context_put(client);