From 129950b5af43e66cf6fa2e326ea1910aac4cceed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Hakl?= Date: Fri, 15 Sep 2023 16:49:33 +0200 Subject: [PATCH] fix flags for serial passthrough on unix --- src/unix/unix_serial_passthrough.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/unix/unix_serial_passthrough.c b/src/unix/unix_serial_passthrough.c index 025f04a5f..de0539d8b 100644 --- a/src/unix/unix_serial_passthrough.c +++ b/src/unix/unix_serial_passthrough.c @@ -149,7 +149,7 @@ plat_serpt_set_params(void *priv) BAUDRATE_RANGE(dev->baudrate, 57600, 115200, B57600); BAUDRATE_RANGE(dev->baudrate, 115200, 0xFFFFFFFF, B115200); - term_attr.c_cflag &= CSIZE; + term_attr.c_cflag &= ~CSIZE; switch (dev->data_bits) { case 8: default: @@ -165,13 +165,13 @@ plat_serpt_set_params(void *priv) term_attr.c_cflag |= CS5; break; } - term_attr.c_cflag &= CSTOPB; + term_attr.c_cflag &= ~CSTOPB; if (dev->serial->lcr & 0x04) term_attr.c_cflag |= CSTOPB; #if !defined(__linux__) - term_attr.c_cflag &= PARENB | PARODD; + term_attr.c_cflag &= ~(PARENB | PARODD); #else - term_attr.c_cflag &= PARENB | PARODD | CMSPAR; + term_attr.c_cflag &= ~(PARENB | PARODD | CMSPAR); #endif if (dev->serial->lcr & 0x08) { term_attr.c_cflag |= PARENB; @@ -182,6 +182,7 @@ plat_serpt_set_params(void *priv) term_attr.c_cflag |= CMSPAR; #endif } + printf("c_cflag=%08x\n", term_attr.c_cflag); tcsetattr(dev->master_fd, TCSANOW, &term_attr); #undef BAUDRATE_RANGE }