Skip to content

Commit 5b8d163

Browse files
kealistreconbot
authored andcommitted
fix(windows): Add option to disable RTS (#1277)
* 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.
1 parent 92c7dd4 commit 5b8d163

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/serialport_win.cpp

+20-3
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,28 @@ void EIO_Open(uv_work_t* req) {
8989
dcb.Parity = NOPARITY;
9090
dcb.ByteSize = 8;
9191
dcb.StopBits = ONESTOPBIT;
92-
dcb.fInX = FALSE;
93-
dcb.fOutX = FALSE;
92+
93+
9494
dcb.fOutxDsrFlow = FALSE;
9595
dcb.fOutxCtsFlow = FALSE;
96-
dcb.fRtsControl = RTS_CONTROL_ENABLE;
96+
97+
if (data->xon) {
98+
dcb.fOutX = TRUE;
99+
} else {
100+
dcb.fOutX = FALSE;
101+
}
102+
103+
if (data->xoff) {
104+
dcb.fInX = TRUE;
105+
} else {
106+
dcb.fInX = FALSE;
107+
}
108+
109+
if (data->rtscts) {
110+
dcb.fRtsControl = RTS_CONTROL_ENABLE;
111+
} else {
112+
dcb.fRtsControl = RTS_CONTROL_DISABLE;
113+
}
97114

98115
dcb.fBinary = true;
99116
dcb.BaudRate = data->baudRate;

0 commit comments

Comments
 (0)