Michal Sojka [Sat, 4 Jan 2020 16:43:02 +0000 (17:43 +0100)]
Ignore CPR ANSI control sequence in exit_on_escapeseq()
In some cases (e.g. Debian's initramfs) the device sends DSR (Device
Status Report) ANSI control sequences as a response to pressing Enter.
Some terminals (e.g. gnome terminal) respond to this by CPR (Cursor
Position Response) sequence, which appears as typed from keyboard. See
https://en.wikipedia.org/wiki/ANSI_escape_code#Terminal_output_sequences.
This complicates exiting sterm, because the exit escape sequence \n~.
must by typed very quickly (actually copy&pasted) so that CPR doesn't
appear between \n and ~..
This commit causes the CPR sequence to be ignored when detecting exit
sequence.
Michal Sojka [Thu, 12 Sep 2019 19:01:07 +0000 (21:01 +0200)]
Handle hang-up event on stdin
When sterm is run with pipe as stdin rather than terminal, as is the
case, for example, with the following command:
ssh somewhere sterm /dev/ttyS0
closing the pipe (e.g. killing ssh) does not send SIGHUP signal, but
POLLHUP event is reported by poll(). When this happened, sterm ended
up in an infinite loop, consuming 100% CPU. Now, we handle this event
and exit.
Michal Sojka [Fri, 4 May 2018 21:55:30 +0000 (23:55 +0200)]
debian: Do not strip binaries during install
This was broken by one of the previous commits. The problem with
"install -s" is that it breaks when crossbuilding the package and it also
prevents creation of dbgsym package.
Michal Sojka [Wed, 21 Sep 2016 14:33:23 +0000 (16:33 +0200)]
Compile with debug information and strip them during install
Debian automatically creates debug symbol package of the binary is
compiled with debug information. If it is compiled without -g, lintian
warns about empty debug symbols.
Michal Sojka [Wed, 19 Aug 2015 22:00:28 +0000 (00:00 +0200)]
Add command mode
This mode is entered before serial line begins. Currently implemented
commands are: dtr, rst and go. "dtr" and "rst" are the same as -d and -r
options, "go" ends command mode and enters serial line interaction.
This is intended for use by novaboot in this way: Novaboot connects to
the serial line to be sure that the target is not occupied. Then it
copies the images, which can take long time, and after that it sends
reset command to reset the target. Without this, the target is reset (by
-d or -r) before copying the images and after that it may be too late to
communicate with the bootloader.
Michal Sojka [Tue, 27 Jan 2015 09:29:55 +0000 (10:29 +0100)]
Disable flow control
RTS/CTS lines may be used for something else than flow control so disable
it. If it turns out that we need it for some hardware, we will add an
command line option to enable it.
Michal Sojka [Tue, 27 Jan 2015 09:19:22 +0000 (10:19 +0100)]
Never block when opening the port
Whether blocking happens depends on the value of CDC signal and previously
set CLOCAL settings. Since we cannot influence CLOCAL settings before
opening the port, we have to use O_NONBLOCK.
Michal Sojka [Wed, 23 Jul 2014 16:49:03 +0000 (18:49 +0200)]
Use liblockdev to lock the tty device
This is simpler and it should also be compatible with systemd initiated
change of /var/lock permissions. See
http://lists.freedesktop.org/archives/systemd-devel/2011-March/001823.html