Commit 28d3d213 authored by Cliff Wright's avatar Cliff Wright Committed by Alexandre Julliard

Fixed a mask set, and other parity setting bugs for serial ports.

parent e6520dcd
...@@ -255,11 +255,11 @@ BOOL16 WINAPI BuildCommDCB16(LPCSTR device, LPDCB16 lpdcb) ...@@ -255,11 +255,11 @@ BOOL16 WINAPI BuildCommDCB16(LPCSTR device, LPDCB16 lpdcb)
*ptr = toupper(*ptr); *ptr = toupper(*ptr);
TRACE(comm,"parity (%c)\n", *ptr); TRACE(comm,"parity (%c)\n", *ptr);
lpdcb->fParity = 1; lpdcb->fParity = TRUE;
switch (*ptr) { switch (*ptr) {
case 'N': case 'N':
lpdcb->Parity = NOPARITY; lpdcb->Parity = NOPARITY;
lpdcb->fParity = 0; lpdcb->fParity = FALSE;
break; break;
case 'E': case 'E':
lpdcb->Parity = EVENPARITY; lpdcb->Parity = EVENPARITY;
...@@ -1459,15 +1459,18 @@ INT16 WINAPI GetCommState16(INT16 fd, LPDCB16 lpdcb) ...@@ -1459,15 +1459,18 @@ INT16 WINAPI GetCommState16(INT16 fd, LPDCB16 lpdcb)
break; break;
} }
switch (port.c_cflag & ~(PARENB | PARODD)) { switch (port.c_cflag & (PARENB | PARODD)) {
case 0: case 0:
lpdcb->fParity = NOPARITY; lpdcb->fParity = FALSE;
lpdcb->Parity = NOPARITY;
break; break;
case PARENB: case PARENB:
lpdcb->fParity = EVENPARITY; lpdcb->fParity = TRUE;
lpdcb->Parity = EVENPARITY;
break; break;
case (PARENB | PARODD): case (PARENB | PARODD):
lpdcb->fParity = ODDPARITY; lpdcb->fParity = TRUE;
lpdcb->Parity = ODDPARITY;
break; break;
} }
...@@ -1578,15 +1581,18 @@ BOOL32 WINAPI GetCommState32(INT32 fd, LPDCB32 lpdcb) ...@@ -1578,15 +1581,18 @@ BOOL32 WINAPI GetCommState32(INT32 fd, LPDCB32 lpdcb)
break; break;
} }
switch (port.c_cflag & ~(PARENB | PARODD)) { switch (port.c_cflag & (PARENB | PARODD)) {
case 0: case 0:
lpdcb->fParity = NOPARITY; lpdcb->fParity = FALSE;
lpdcb->Parity = NOPARITY;
break; break;
case PARENB: case PARENB:
lpdcb->fParity = EVENPARITY; lpdcb->fParity = TRUE;
lpdcb->Parity = EVENPARITY;
break; break;
case (PARENB | PARODD): case (PARENB | PARODD):
lpdcb->fParity = ODDPARITY; lpdcb->fParity = TRUE;
lpdcb->Parity = ODDPARITY;
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment