From 2ea3dd12b13814cd9643c4216d817bf8488275a1 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 21 Jan 2008 21:45:18 +0100 Subject: [PATCH] ntdll: Fixed getting the RTS status from line, and now using sane default values for all (compilation/system) cases. --- dlls/ntdll/serial.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c index 6866b952dac..c54d70696e6 100644 --- a/dlls/ntdll/serial.c +++ b/dlls/ntdll/serial.c @@ -188,24 +188,29 @@ static NTSTATUS get_baud_rate(int fd, SERIAL_BAUD_RATE* sbr) static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf) { - int stat; + int stat = 0; struct termios port; - + if (tcgetattr(fd, &port) == -1) { ERR("tcgetattr error '%s'\n", strerror(errno)); return FILE_GetNtStatus(); } + /* termios does not support DTR/DSR flow control */ + shf->ControlHandShake = 0; + shf->FlowReplace = 0; #ifdef TIOCMGET if (ioctl(fd, TIOCMGET, &stat) == -1) { WARN("ioctl error '%s'\n", strerror(errno)); - stat = DTR_CONTROL_ENABLE | RTS_CONTROL_ENABLE; + shf->ControlHandShake |= SERIAL_DTR_CONTROL; + shf->FlowReplace |= SERIAL_RTS_CONTROL; } +#else + WARN("Setting DTR/RTS to enabled by default\n"); + shf->ControlHandShake |= SERIAL_DTR_CONTROL; + shf->FlowReplace |= SERIAL_RTS_CONTROL; #endif - /* termios does not support DTR/DSR flow control */ - shf->ControlHandShake = 0; - shf->FlowReplace = 0; #ifdef TIOCM_DTR if (stat & TIOCM_DTR) #endif @@ -213,7 +218,7 @@ static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf) #ifdef CRTSCTS if (port.c_cflag & CRTSCTS) { - shf->ControlHandShake |= SERIAL_DTR_CONTROL | SERIAL_DTR_HANDSHAKE; + shf->FlowReplace |= SERIAL_RTS_CONTROL; shf->ControlHandShake |= SERIAL_CTS_HANDSHAKE; } else @@ -222,7 +227,7 @@ static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf) #ifdef TIOCM_RTS if (stat & TIOCM_RTS) #endif - shf->ControlHandShake |= SERIAL_RTS_CONTROL; + shf->FlowReplace |= SERIAL_RTS_CONTROL; } if (port.c_iflag & IXOFF) shf->FlowReplace |= SERIAL_AUTO_RECEIVE; -- 2.11.4.GIT