From: Martin Ling Date: Sun, 27 Oct 2013 11:29:25 +0000 (+0000) Subject: Minor changes to port flags on Unix, to remain in sync with libsigrok. X-Git-Tag: libserialport-0.1.0~162 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=8683177b9d2a17ff40df49e0f90ce818a0b5e209;p=libserialport.git Minor changes to port flags on Unix, to remain in sync with libsigrok. --- diff --git a/serialport.c b/serialport.c index 6fc5268..0895048 100644 --- a/serialport.c +++ b/serialport.c @@ -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;