aboutsummaryrefslogtreecommitdiff
path: root/tools/kwboot.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-09-24 23:07:08 +0200
committerStefan Roese <sr@denx.de>2021-10-01 11:07:13 +0200
commitc704e0e1df93328a336780c8e3dd87ad44b4f351 (patch)
tree16a55f5358017c65983c987b5ba953794138df49 /tools/kwboot.c
parent99a3d02370b6b526594ee73eb26d39e8d8ced8d3 (diff)
downloadu-boot-c704e0e1df93328a336780c8e3dd87ad44b4f351.zip
u-boot-c704e0e1df93328a336780c8e3dd87ad44b4f351.tar.gz
u-boot-c704e0e1df93328a336780c8e3dd87ad44b4f351.tar.bz2
tools: kwboot: Fix initializing tty device
Retrieve current terminal settings via tcgetattr(), set to raw mode with cfmakeraw(), enable receiver via CREAD and ignore modem control lines via CLOCAL. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools/kwboot.c')
-rw-r--r--tools/kwboot.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index d8b9507..fc83161 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -648,11 +648,12 @@ kwboot_open_tty(const char *path, int baudrate)
if (fd < 0)
goto out;
- memset(&tio, 0, sizeof(tio));
-
- tio.c_iflag = 0;
- tio.c_cflag = CREAD|CLOCAL|CS8;
+ rc = tcgetattr(fd, &tio);
+ if (rc)
+ goto out;
+ cfmakeraw(&tio);
+ tio.c_cflag |= CREAD|CLOCAL;
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 10;