ntdll: Fixed getting the RTS status from line, and now using sane default values for all (compilation/system) cases.
This commit is contained in:
parent
0920f8e778
commit
2ea3dd12b1
|
@ -188,7 +188,7 @@ static NTSTATUS get_baud_rate(int fd, SERIAL_BAUD_RATE* sbr)
|
||||||
|
|
||||||
static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf)
|
static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf)
|
||||||
{
|
{
|
||||||
int stat;
|
int stat = 0;
|
||||||
struct termios port;
|
struct termios port;
|
||||||
|
|
||||||
if (tcgetattr(fd, &port) == -1)
|
if (tcgetattr(fd, &port) == -1)
|
||||||
|
@ -196,16 +196,21 @@ static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf)
|
||||||
ERR("tcgetattr error '%s'\n", strerror(errno));
|
ERR("tcgetattr error '%s'\n", strerror(errno));
|
||||||
return FILE_GetNtStatus();
|
return FILE_GetNtStatus();
|
||||||
}
|
}
|
||||||
|
/* termios does not support DTR/DSR flow control */
|
||||||
|
shf->ControlHandShake = 0;
|
||||||
|
shf->FlowReplace = 0;
|
||||||
#ifdef TIOCMGET
|
#ifdef TIOCMGET
|
||||||
if (ioctl(fd, TIOCMGET, &stat) == -1)
|
if (ioctl(fd, TIOCMGET, &stat) == -1)
|
||||||
{
|
{
|
||||||
WARN("ioctl error '%s'\n", strerror(errno));
|
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
|
#endif
|
||||||
/* termios does not support DTR/DSR flow control */
|
|
||||||
shf->ControlHandShake = 0;
|
|
||||||
shf->FlowReplace = 0;
|
|
||||||
#ifdef TIOCM_DTR
|
#ifdef TIOCM_DTR
|
||||||
if (stat & TIOCM_DTR)
|
if (stat & TIOCM_DTR)
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,7 +218,7 @@ static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf)
|
||||||
#ifdef CRTSCTS
|
#ifdef CRTSCTS
|
||||||
if (port.c_cflag & CRTSCTS)
|
if (port.c_cflag & CRTSCTS)
|
||||||
{
|
{
|
||||||
shf->ControlHandShake |= SERIAL_DTR_CONTROL | SERIAL_DTR_HANDSHAKE;
|
shf->FlowReplace |= SERIAL_RTS_CONTROL;
|
||||||
shf->ControlHandShake |= SERIAL_CTS_HANDSHAKE;
|
shf->ControlHandShake |= SERIAL_CTS_HANDSHAKE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -222,7 +227,7 @@ static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf)
|
||||||
#ifdef TIOCM_RTS
|
#ifdef TIOCM_RTS
|
||||||
if (stat & TIOCM_RTS)
|
if (stat & TIOCM_RTS)
|
||||||
#endif
|
#endif
|
||||||
shf->ControlHandShake |= SERIAL_RTS_CONTROL;
|
shf->FlowReplace |= SERIAL_RTS_CONTROL;
|
||||||
}
|
}
|
||||||
if (port.c_iflag & IXOFF)
|
if (port.c_iflag & IXOFF)
|
||||||
shf->FlowReplace |= SERIAL_AUTO_RECEIVE;
|
shf->FlowReplace |= SERIAL_AUTO_RECEIVE;
|
||||||
|
|
Loading…
Reference in New Issue