1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Minor changes to port flags on Unix, to remain in sync with libsigrok.

This commit is contained in:
Martin Ling 2013-10-27 11:29:25 +00:00 committed by Uwe Hermann
parent db2794cea9
commit 8683177b9d

View File

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