This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7e75c475d46f304d16fce7e95d0861eb73ae2da9
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Sat Dec 17 03:33:15 2022 +0800

    arch/sim: Move '\n' process from tty_send to up_putc
    
    to avoid this special process happen twice
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 arch/sim/src/sim/sim_uart.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/sim/src/sim/sim_uart.c b/arch/sim/src/sim/sim_uart.c
index 7d8b4dc7bd..6ebf3d8d87 100644
--- a/arch/sim/src/sim/sim_uart.c
+++ b/arch/sim/src/sim/sim_uart.c
@@ -428,13 +428,6 @@ static void tty_send(struct uart_dev_s *dev, int ch)
 {
   struct tty_priv_s *priv = dev->priv;
 
-  /* For console device */
-
-  if (dev->isconsole && ch == '\n')
-    {
-      host_uart_putc(1, '\r');
-    }
-
   host_uart_putc(dev->isconsole ? 1 : priv->fd, ch);
 }
 
@@ -567,6 +560,11 @@ void sim_uartloop(void)
 int up_putc(int ch)
 {
 #ifdef USE_DEVCONSOLE
+  if (ch == '\n')
+    {
+      tty_send(&g_console_dev, '\r');
+    }
+
   tty_send(&g_console_dev, ch);
 #endif
   return 0;

Reply via email to