Skip to content
Snippets Groups Projects
Commit b8260ae6 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't reset the port baud rate to 0 in comOpen()

As noticed while trouble-shooting issue #813, calling comOpen() would
(on Linux, at least) set the port baud rate to 0 bps (B0) which in
most or all Linux serial drivers triggers special logic to deassert DTR and
RTS signals (to the modem, to attempt to "hangup" any connection).

If the app (e.g. sexpots) did not explictily set the port baud rate after
calling comOpen(), the port would be unusable. This is not how comOpen() works
on Windows.

So rather than just overwrite all the bits in termios.c_cflag, we clear the
fields we know we want to, set the bits we want, and leave the rest (which
usually includes the current baud rate, if CBAUD is defined) as-is.
parent dd287bf2
No related branches found
No related tags found
No related merge requests found
Pipeline #7067 failed
......@@ -221,7 +221,8 @@ COM_HANDLE comOpen(const char* device)
| IGNPAR /* ignore (discard) parity errors */
);
t.c_oflag = 0; /* No output processing */
t.c_cflag = (
t.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD);
t.c_cflag |= (
CS8 /* 8 bits */
| CREAD /* enable receiver */
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment