Merge pull request #118 from mwm/master

Fix file open to actually turn on inbound parity checking.
This commit is contained in:
Roger Clark 2016-04-17 20:51:59 +10:00
commit 9695c368e0
1 changed files with 5 additions and 2 deletions

View File

@ -128,8 +128,8 @@ static port_err_t serial_setup(serial_t *h, const serial_baud_t baud,
switch (parity) {
case SERIAL_PARITY_NONE: port_parity = 0; break;
case SERIAL_PARITY_EVEN: port_parity = INPCK | PARENB; break;
case SERIAL_PARITY_ODD: port_parity = INPCK | PARENB | PARODD; break;
case SERIAL_PARITY_EVEN: port_parity = PARENB; break;
case SERIAL_PARITY_ODD: port_parity = PARENB | PARODD; break;
default:
return PORT_ERR_UNKNOWN;
@ -149,6 +149,9 @@ static port_err_t serial_setup(serial_t *h, const serial_baud_t baud,
#else /* __sun */
h->newtio.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
| IGNCR | ICRNL | IXON);
if (port_parity)
h->newtio.c_iflag |= INPCK;
h->newtio.c_oflag &= ~OPOST;
h->newtio.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
h->newtio.c_cflag &= ~(CSIZE | PARENB);