Skip to content

Commit

Permalink
fix(windows): Add option to disable RTS (#1277)
Browse files Browse the repository at this point in the history
* Add option to disable RTS on Windows
* Add support for XON / XOFF on Windows.  This is probably not feature complete in terms of missing the XonChar, XoffChar, XonLim fields of DCB, but I am not as familiar with this aspect of serial comms.

BREAKING CHANGE:
We previously hard coded to have RTS On for windows at all times.
  • Loading branch information
kealist authored and reconbot committed Aug 6, 2017
1 parent 92c7dd4 commit 5b8d163
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/serialport_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,28 @@ void EIO_Open(uv_work_t* req) {
dcb.Parity = NOPARITY;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT;
dcb.fInX = FALSE;
dcb.fOutX = FALSE;


dcb.fOutxDsrFlow = FALSE;
dcb.fOutxCtsFlow = FALSE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;

if (data->xon) {
dcb.fOutX = TRUE;
} else {
dcb.fOutX = FALSE;
}

if (data->xoff) {
dcb.fInX = TRUE;
} else {
dcb.fInX = FALSE;
}

if (data->rtscts) {
dcb.fRtsControl = RTS_CONTROL_ENABLE;
} else {
dcb.fRtsControl = RTS_CONTROL_DISABLE;
}

dcb.fBinary = true;
dcb.BaudRate = data->baudRate;
Expand Down

0 comments on commit 5b8d163

Please sign in to comment.