]> sigrok.org Git - libserialport.git/commitdiff
Minor changes to port flags on Unix, to remain in sync with libsigrok.
authorMartin Ling <redacted>
Sun, 27 Oct 2013 11:29:25 +0000 (11:29 +0000)
committerUwe Hermann <redacted>
Thu, 14 Nov 2013 23:42:37 +0000 (00:42 +0100)
serialport.c

index 6fc52688c6d4871bacf07cf3361f4843eae9d3b6..0895048cf2f1ab7cbb3f0e0e132c0da80c9d98b0 100644 (file)
@@ -618,7 +618,7 @@ int sp_set_params(struct sp_port *port, int baudrate,
                return SP_ERR_ARG;
        }
 
-       term.c_iflag &= ~(IXON | IXOFF);
+       term.c_iflag &= ~(IXON | IXOFF | IXANY);
        term.c_cflag &= ~CRTSCTS;
        switch (flowcontrol) {
        case 0:
@@ -628,14 +628,14 @@ int sp_set_params(struct sp_port *port, int baudrate,
                term.c_cflag |= CRTSCTS;
                break;
        case 2:
-               term.c_iflag |= IXON | IXOFF;
+               term.c_iflag |= IXON | IXOFF | IXANY;
                break;
        default:
                return SP_ERR_ARG;
        }
 
        term.c_iflag &= ~IGNPAR;
-       term.c_cflag &= ~(PARODD | PARENB);
+       term.c_cflag &= ~(PARENB | PARODD);
        switch (parity) {
        case SP_PARITY_NONE:
                term.c_iflag |= IGNPAR;
@@ -660,6 +660,9 @@ int sp_set_params(struct sp_port *port, int baudrate,
        /* Disable canonical mode, and don't echo input characters. */
        term.c_lflag &= ~(ICANON | ECHO);
 
+       /* Ignore modem status lines; enable receiver */
+       term.c_cflag |= (CLOCAL | CREAD);
+
        /* Write the configured settings. */
        if (tcsetattr(port->fd, TCSADRAIN, &term) < 0)
                return SP_ERR_FAIL;