This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 73d9a1b4a2 sim: disable sim uart output processing
73d9a1b4a2 is described below
commit 73d9a1b4a2c594b440cf24f419353c5f78ad2ceb
Author: yinshengkai <[email protected]>
AuthorDate: Mon Apr 29 15:51:47 2024 +0800
sim: disable sim uart output processing
Using the host serial port to send data in sim will convert \r to \r\n
Signed-off-by: yinshengkai <[email protected]>
---
arch/sim/src/nuttx-names.in | 1 +
arch/sim/src/sim/posix/sim_hostuart.c | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/sim/src/nuttx-names.in b/arch/sim/src/nuttx-names.in
index 08bb3a7981..d3361cb958 100644
--- a/arch/sim/src/nuttx-names.in
+++ b/arch/sim/src/nuttx-names.in
@@ -38,6 +38,7 @@ NXSYMBOLS(atexit)
NXSYMBOLS(backtrace)
NXSYMBOLS(bind)
NXSYMBOLS(calloc)
+NXSYMBOLS(cfmakeraw)
NXSYMBOLS(chmod)
NXSYMBOLS(chdir)
NXSYMBOLS(chown)
diff --git a/arch/sim/src/sim/posix/sim_hostuart.c
b/arch/sim/src/sim/posix/sim_hostuart.c
index 33afe8c9af..3421e92b9e 100644
--- a/arch/sim/src/sim/posix/sim_hostuart.c
+++ b/arch/sim/src/sim/posix/sim_hostuart.c
@@ -55,11 +55,16 @@ static void setrawmode(int fd)
/* Switch to raw mode */
- raw.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR |
- ICRNL | IXON);
- raw.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
- raw.c_cflag &= ~(CSIZE | PARENB);
- raw.c_cflag |= CS8;
+ cfmakeraw(&raw);
+
+ /* Disable output processing, We need to exclude stdout to prevent the
+ * terminal configuration from being changed after an abnormal exit.
+ */
+
+ if (fd == 0)
+ {
+ raw.c_oflag |= OPOST;
+ }
tcsetattr(fd, TCSANOW, &raw);
}