1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

sp: clear HUPCL to preserve control lines on close

The comment and code are out of sync. The comments say "leave control
lines alone on close." The HUPCL bit, when set, will "Lower modem control
lines after last process closes the device (hang up)."

To match the intent captured in the comment, the HUPCL bit should be
cleared.

Signed-off-by: Ben Gardiner <ben.l.gardiner@gmail.com>
This commit is contained in:
Ben Gardiner 2020-09-22 03:10:08 +00:00
parent 086a418145
commit 1b011060df

View File

@ -633,7 +633,8 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
data.term.c_cc[VTIME] = 0; data.term.c_cc[VTIME] = 0;
/* Ignore modem status lines; enable receiver; leave control lines alone on close. */ /* Ignore modem status lines; enable receiver; leave control lines alone on close. */
data.term.c_cflag |= (CLOCAL | CREAD | HUPCL); data.term.c_cflag |= (CLOCAL | CREAD);
data.term.c_cflag &= ~(HUPCL);
#endif #endif
#ifdef _WIN32 #ifdef _WIN32