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/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 51c778b  system/cu: fix setting termios with parity
51c778b is described below

commit 51c778bc5c92e7f9643758e849e8f09da7d230e1
Author: Oleg <[email protected]>
AuthorDate: Mon Jul 19 11:40:28 2021 +0300

    system/cu: fix setting termios with parity
    
    clear only the bits in c_cflag that will be set by cu
---
 system/cu/cu_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c
index 54fae73..54edc6c 100644
--- a/system/cu/cu_main.c
+++ b/system/cu/cu_main.c
@@ -146,14 +146,16 @@ static int set_termios(int fd, int rate, enum parity_mode 
parity,
 
   tio = g_tio_dev;
 
+  tio.c_cflag &= ~(PARENB | PARODD | CRTSCTS);
+
   switch (parity)
     {
       case PARITY_EVEN:
-        tio.c_cflag = PARENB;
+        tio.c_cflag |= PARENB;
         break;
 
       case PARITY_ODD:
-        tio.c_cflag = PARENB | PARODD;
+        tio.c_cflag |= PARENB | PARODD;
         break;
 
       case PARITY_NONE:

Reply via email to