diff packages/io/serial/current/src/common/termiostty.c @ 2532:af5755a0cc71

* src/common/termiostty.c (set_attr) : Fixed bug for XON/XOFF flow control that was wrong in termiostty. set_attr() now looks into c_iflag for IXON/IXOFF flags.
author jlarmour
date Wed, 20 Aug 2008 14:48:40 +0000
parents 4fa061bf5e97
children 74dbf4c3f2e1
line wrap: on
line diff
--- a/packages/io/serial/current/src/common/termiostty.c
+++ b/packages/io/serial/current/src/common/termiostty.c
@@ -465,11 +465,11 @@ set_attr( struct termios *t, struct term
         }
     }
 
-    if ( (t->c_cflag & IXOFF) != (ptermios->c_cflag & IXOFF) ) {
+    if ( (t->c_iflag & IXOFF) != (ptermios->c_iflag & IXOFF) ) {
         new_dev_conf = dev_conf;
         new_dev_conf.flags &=
             ~(CYGNUM_SERIAL_FLOW_XONXOFF_RX|CYGNUM_SERIAL_FLOW_RTSCTS_RX);
-        if ( t->c_cflag & IXOFF )
+        if ( t->c_iflag & IXOFF )
             if ( t->c_cflag & CRTSCTS)
                 new_dev_conf.flags |= CYGNUM_SERIAL_FLOW_RTSCTS_RX;
             else
@@ -485,16 +485,18 @@ set_attr( struct termios *t, struct term
             // It worked, so update dev_conf to reflect the new state
             dev_conf.flags = new_dev_conf.flags;
             // and termios
-            ptermios->c_cflag &= ~(IXOFF|CRTSCTS);
-            ptermios->c_cflag |= t->c_cflag & (IXOFF|CRTSCTS);
+            ptermios->c_cflag &= ~(CRTSCTS);
+            ptermios->c_cflag |= t->c_cflag & (CRTSCTS);
+            ptermios->c_iflag &= ~(IXOFF);
+            ptermios->c_iflag |= t->c_iflag & (IXOFF);
         }
     }
 
-    if ( (t->c_cflag & IXON) != (ptermios->c_cflag & IXON) ) {
+    if ( (t->c_iflag & IXON) != (ptermios->c_iflag & IXON) ) {
         new_dev_conf = dev_conf;
         new_dev_conf.flags &=
             ~(CYGNUM_SERIAL_FLOW_XONXOFF_TX|CYGNUM_SERIAL_FLOW_RTSCTS_TX);
-        if ( t->c_cflag & IXON )
+        if ( t->c_iflag & IXON )
             if ( t->c_cflag & CRTSCTS)
                 new_dev_conf.flags |= CYGNUM_SERIAL_FLOW_RTSCTS_TX;
             else
@@ -510,8 +512,10 @@ set_attr( struct termios *t, struct term
             // It worked, so update dev_conf to reflect the new state
             dev_conf.flags = new_dev_conf.flags;
             // and termios
-            ptermios->c_cflag &= ~(IXON|CRTSCTS);
-            ptermios->c_cflag |= t->c_cflag & (IXON|CRTSCTS);
+            ptermios->c_cflag &= ~(CRTSCTS);
+            ptermios->c_cflag |= t->c_cflag & (CRTSCTS);
+            ptermios->c_iflag &= ~(IXON);
+            ptermios->c_iflag |= t->c_iflag & (IXON);
         }
     }