1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Fix HUPCL handling

Picocom will always set the HUPCL control bit of the serial port,
according to the --noreset option. If --noreset is given, then
HUPCL for the port is cleared, and will remain so after exiting
picocom. If --noreset is *not* given, then HUPCL is set for the
port, and will remain so after exiting picocom. This is true, regardless
of the way picocom terminates (command, read zero-bytes from standard
input, killed by signal, etc), and regardless of the --noinit
option. If picocom exits with the "Quit" command, then --noreset is
assumed given. Almost always this is the most DWIM behavior.

Fixes #72
This commit is contained in:
Nick Patavalis
2017-12-20 05:59:55 +02:00
parent 33c2332c18
commit 82d69071c3
2 changed files with 18 additions and 7 deletions

11
term.c
View File

@ -739,6 +739,17 @@ term_apply (int fd, int now)
term.currtermios[i] = term.nexttermios[i];
/* Set HUPCL to origtermios as well. Since setting HUPCL
affects the behavior on close(2), we most likely want it to
also apply when the filedes is implicitly closed by
exit(3)ing the program. Since, uppon exiting, we restore
the original settings, this wouldn't happen unless we also
set HUPCL to origtermios. */
if ( term.currtermios[i].c_cflag & HUPCL )
term.origtermios[i].c_cflag |= HUPCL;
else
term.origtermios[i].c_cflag &= ~HUPCL;
} while (0);
return rval;