From 38492576bc5915adec990f08a6f70cbcfa97a418 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 2 Feb 2024 12:10:24 +0100 Subject: [PATCH] sys/net/telnet: disable local echo --- sys/net/application_layer/telnet/telnet_server.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/net/application_layer/telnet/telnet_server.c b/sys/net/application_layer/telnet/telnet_server.c index c167a0a053f4..6ab40bb677a4 100644 --- a/sys/net/application_layer/telnet/telnet_server.c +++ b/sys/net/application_layer/telnet/telnet_server.c @@ -195,6 +195,17 @@ static void _process_cmd(uint8_t cmd, uint8_t option) } } +static void _send_opts(void) +{ + if (IS_USED(MODULE_STDIO_TELNET)) { + /* RIOT will echo stdio, disable local echo */ + const uint8_t opt_echo[] = { + TELNET_CMD_IAC, TELNET_CMD_WILL, TELNET_OPT_ECHO + }; + _write_buffer(opt_echo, sizeof(opt_echo)); + } +} + static void *telnet_thread(void *arg) { (void)arg; @@ -210,6 +221,7 @@ static void *telnet_thread(void *arg) DEBUG("connected\n"); _connected(); + _send_opts(); bool is_cmd = false; uint8_t is_option = 0;