]> sigrok.org Git - libserialport.git/commitdiff
Return SP_ERR_SUPP on attempt to set mark/space parity without CMSPAR.
authorMartin Ling <redacted>
Tue, 26 Nov 2013 15:26:18 +0000 (15:26 +0000)
committerMartin Ling <redacted>
Tue, 26 Nov 2013 15:26:18 +0000 (15:26 +0000)
serialport.c

index 82ccf2fdc5129b2747265e1584fb52c844540f0c..7ee60db2b34c1590a1917be600ccba132c233c8c 100644 (file)
@@ -1456,18 +1456,20 @@ static enum sp_return set_config(struct sp_port *port, struct port_data *data,
                case SP_PARITY_ODD:
                        data->term.c_cflag |= PARENB | PARODD;
                        break;
+#ifdef CMSPAR
                case SP_PARITY_MARK:
                        data->term.c_cflag |= PARENB | PARODD;
-#ifdef CMSPAR
                        data->term.c_cflag |= CMSPAR;
-#endif
                        break;
                case SP_PARITY_SPACE:
                        data->term.c_cflag |= PARENB;
-#ifdef CMSPAR
                        data->term.c_cflag |= CMSPAR;
-#endif
                        break;
+#else
+               case SP_PARITY_MARK:
+               case SP_PARITY_SPACE:
+                       RETURN_ERROR(SP_ERR_SUPP, "Mark/space parity not supported");
+#endif
                default:
                        RETURN_ERROR(SP_ERR_ARG, "Invalid parity setting");
                }