Commit a63be082 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ntdll: Make set_line_control() for a serial device print slightly more informative messages.

parent a20b07c5
...@@ -575,35 +575,33 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc) ...@@ -575,35 +575,33 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc)
{ {
struct termios port; struct termios port;
unsigned bytesize, stopbits; unsigned bytesize, stopbits;
if (tcgetattr(fd, &port) == -1) if (tcgetattr(fd, &port) == -1)
{ {
ERR("tcgetattr error '%s'\n", strerror(errno)); ERR("tcgetattr error '%s'\n", strerror(errno));
return FILE_GetNtStatus(); return FILE_GetNtStatus();
} }
#ifdef IMAXBEL #ifdef IMAXBEL
port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR|PARMRK|IMAXBEL); port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR|PARMRK|IMAXBEL);
#else #else
port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR|PARMRK); port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR|PARMRK);
#endif #endif
port.c_iflag |= IGNBRK | INPCK; port.c_iflag |= IGNBRK | INPCK;
port.c_oflag &= ~(OPOST); port.c_oflag &= ~(OPOST);
port.c_cflag &= ~(HUPCL); port.c_cflag &= ~(HUPCL);
port.c_cflag |= CLOCAL | CREAD; port.c_cflag |= CLOCAL | CREAD;
/* /*
* on FreeBSD, turning off ICANON does not disable IEXTEN, * on FreeBSD, turning off ICANON does not disable IEXTEN,
* so we must turn it off explicitly. No harm done on Linux. * so we must turn it off explicitly. No harm done on Linux.
*/ */
port.c_lflag &= ~(ICANON|ECHO|ISIG|IEXTEN); port.c_lflag &= ~(ICANON|ECHO|ISIG|IEXTEN);
port.c_lflag |= NOFLSH; port.c_lflag |= NOFLSH;
bytesize = slc->WordLength; bytesize = slc->WordLength;
stopbits = slc->StopBits; stopbits = slc->StopBits;
#ifdef CMSPAR #ifdef CMSPAR
port.c_cflag &= ~(PARENB | PARODD | CMSPAR); port.c_cflag &= ~(PARENB | PARODD | CMSPAR);
#else #else
...@@ -633,7 +631,7 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc) ...@@ -633,7 +631,7 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc)
} }
else else
{ {
ERR("Cannot set MARK Parity\n"); FIXME("Cannot set MARK Parity\n");
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
break; break;
...@@ -645,16 +643,16 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc) ...@@ -645,16 +643,16 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc)
} }
else else
{ {
ERR("Cannot set SPACE Parity\n"); FIXME("Cannot set SPACE Parity\n");
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
break; break;
#endif #endif
default: default:
ERR("Parity\n"); FIXME("Parity %d is not supported\n", slc->Parity);
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
port.c_cflag &= ~CSIZE; port.c_cflag &= ~CSIZE;
switch (bytesize) switch (bytesize)
{ {
...@@ -663,17 +661,17 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc) ...@@ -663,17 +661,17 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc)
case 7: port.c_cflag |= CS7; break; case 7: port.c_cflag |= CS7; break;
case 8: port.c_cflag |= CS8; break; case 8: port.c_cflag |= CS8; break;
default: default:
ERR("ByteSize\n"); FIXME("ByteSize %d is not supported\n", bytesize);
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
switch (stopbits) switch (stopbits)
{ {
case ONESTOPBIT: port.c_cflag &= ~CSTOPB; break; case ONESTOPBIT: port.c_cflag &= ~CSTOPB; break;
case ONE5STOPBITS: /* will be selected if bytesize is 5 */ case ONE5STOPBITS: /* will be selected if bytesize is 5 */
case TWOSTOPBITS: port.c_cflag |= CSTOPB; break; case TWOSTOPBITS: port.c_cflag |= CSTOPB; break;
default: default:
ERR("StopBits\n"); FIXME("StopBits %d is not supported\n", stopbits);
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
/* otherwise it hangs with pending input*/ /* otherwise it hangs with pending input*/
......
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