]> sourceware.org Git - newlib-cygwin.git/commitdiff
fhandler_serial.cc: MARK and SPACE parity for serial port
authorMarek Smetana <mara.smetana@gmail.com>
Mon, 1 Feb 2021 21:02:14 +0000 (22:02 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 2 Feb 2021 09:41:01 +0000 (10:41 +0100)
winsup/cygwin/fhandler_serial.cc
winsup/cygwin/include/sys/termios.h

index fd5b458998e0ba9847167dffcd429b1dbc9ef5e0..e0257302cc39647de5e69e980bcca8b9f0d5f9eb 100644 (file)
@@ -727,7 +727,12 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
   /* -------------- Set parity ------------------ */
 
   if (t->c_cflag & PARENB)
-    state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;
+    {
+      if(t->c_cflag & CMSPAR)
+        state.Parity = (t->c_cflag & PARODD) ? MARKPARITY : SPACEPARITY;
+      else
+        state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;
+    }
   else
     state.Parity = NOPARITY;
 
@@ -1068,6 +1073,10 @@ fhandler_serial::tcgetattr (struct termios *t)
     t->c_cflag |= (PARENB | PARODD);
   if (state.Parity == EVENPARITY)
     t->c_cflag |= PARENB;
+  if (state.Parity == MARKPARITY)
+    t->c_cflag |= (PARENB | PARODD | CMSPAR);
+  if (state.Parity == SPACEPARITY)
+    t->c_cflag |= (PARENB | CMSPAR);
 
   /* -------------- Parity errors ------------------ */
 
index 17e8d83a3dfa573a8b9ef5a7811d971b43a9ab7d..e4465fca356fe7b16f6c80e11f999b1af76a675a 100644 (file)
@@ -206,6 +206,7 @@ POSIX commands */
 
 #define CRTSXOFF 0x04000
 #define CRTSCTS         0x08000
+#define CMSPAR  0x40000000 /* Mark or space (stick) parity.  */
 
 /* lflag bits */
 #define ISIG   0x0001
This page took 0.033811 seconds and 5 git commands to generate.