From 9f52373558578a1184df19fe7645b41efef35def Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 7 Oct 2026 16:09:47 +0200 Subject: [PATCH] drivers/net/telnet: Send CR LF as end of line. telnet_putchar() appended the carriage return after the line feed, so every output line ended with LF CR. RFC 854 defines the telnet end of line as CR LF. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: raiden00pl --- drivers/net/telnet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index a76f4ab459b..daee0692d94 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -591,17 +591,14 @@ static bool telnet_putchar(FAR struct telnet_dev_s *priv, uint8_t ch, if (ch != TELNET_CR) { - /* Add all other characters to the destination buffer */ - index = *nread; - priv->td_txbuffer[index++] = ch; - /* Check for line feeds */ + /* Telnet end of line is CR LF (RFC 854): put the carriage return + * before the line feed. + */ if (ch == TELNET_NL) { - /* Now add the carriage return */ - priv->td_txbuffer[index++] = TELNET_CR; /* End of line */ @@ -609,6 +606,9 @@ static bool telnet_putchar(FAR struct telnet_dev_s *priv, uint8_t ch, ret = true; } + /* Add all other characters to the destination buffer */ + + priv->td_txbuffer[index++] = ch; *nread = index; }