Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions hooklib/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,27 +349,27 @@ static BOOL WINAPI my_GetCommState(HANDLE fd, DCB *dcb)
dcb->fDsrSensitivity = 1;
}

if (handflow.ControlHandShake & SERIAL_XOFF_CONTINUE) {
if (handflow.FlowReplace & SERIAL_XOFF_CONTINUE) {
dcb->fTXContinueOnXoff = 1;
}

if (handflow.ControlHandShake & SERIAL_RTS_CONTROL) {
if (handflow.FlowReplace & SERIAL_RTS_CONTROL) {
dcb->fRtsControl = RTS_CONTROL_ENABLE;
}

if (handflow.ControlHandShake & SERIAL_RTS_HANDSHAKE) {
if (handflow.FlowReplace & SERIAL_RTS_HANDSHAKE) {
dcb->fRtsControl = RTS_CONTROL_HANDSHAKE;
}

if (handflow.ControlHandShake & SERIAL_ERROR_ABORT) {
dcb->fAbortOnError = 1;
}

if (handflow.ControlHandShake & SERIAL_ERROR_CHAR) {
if (handflow.FlowReplace & SERIAL_ERROR_CHAR) {
dcb->fErrorChar = 1;
}

if (handflow.ControlHandShake & SERIAL_NULL_STRIPPING) {
if (handflow.FlowReplace & SERIAL_NULL_STRIPPING) {
dcb->fNull = 1;
}

Expand Down Expand Up @@ -526,20 +526,20 @@ static BOOL WINAPI my_SetCommState(HANDLE fd, const DCB *dcb)
}

if (dcb->fTXContinueOnXoff) {
handflow.ControlHandShake |= SERIAL_XOFF_CONTINUE;
handflow.FlowReplace |= SERIAL_XOFF_CONTINUE;
}

switch (dcb->fRtsControl) {
case RTS_CONTROL_DISABLE:
break;

case RTS_CONTROL_ENABLE:
handflow.ControlHandShake |= SERIAL_RTS_CONTROL;
handflow.FlowReplace |= SERIAL_RTS_CONTROL;

break;

case RTS_CONTROL_HANDSHAKE:
handflow.ControlHandShake |= SERIAL_RTS_HANDSHAKE;
handflow.FlowReplace |= SERIAL_RTS_HANDSHAKE;

break;

Expand All @@ -549,6 +549,14 @@ static BOOL WINAPI my_SetCommState(HANDLE fd, const DCB *dcb)
return FALSE;
}

if (dcb->fErrorChar) {
handflow.FlowReplace |= SERIAL_ERROR_CHAR;
}

if (dcb->fNull) {
handflow.FlowReplace |= SERIAL_NULL_STRIPPING;
}

memset(&line, 0, sizeof(line));
line.WordLength = dcb->ByteSize;
line.Parity = dcb->Parity;
Expand Down