Rework toggle and pulse feature to support all lines

Replace existing toggle and pulse key commands with the following
generalized key commands which allows to toggle or pulse all serial port
lines:

 ctrl-t g   Toggle serial port line
 ctrl-t p   Pulse serial port line

When used, user will be asked which serial line to toggle or pulse.

Also introduce --line-pulse-duration option for setting specific pulse
duration in milliseconds for each serial line using a key value pair
format. Each key represents a serial line. The following keys are
available: DTR, RTS, CTS, DSR, DCD, RI.

Example:

 $ tio /dev/ttyUSB0 --line-pulse-duration DTR=200,RTS=300,RI=50

Likewise, the pulse duration can also be set via configuration file
using the line-pulse-duration variable:

 line-pulse-duration = DTR=200,RTS=300,RI=50
This commit is contained in:
Martin Lund 2022-07-19 12:13:56 +02:00
parent 35f249394c
commit 3903880106
9 changed files with 277 additions and 83 deletions

View file

@ -52,9 +52,26 @@ Set output delay [ms] inserted between each sent character (default: 0).
Set output delay [ms] inserted between each sent line (default: 0).
.TP
.BR " \-\-dtr\-pulse\-duration " \fI<ms>
.BR " \-\-line\-pulse\-duration " \fI<duration>
Set the duration [ms] of the DTR pulse (default: 100).
Set the pulse duration [ms] of each serial port line using the following key
valur pair format in the duration field: <key>=<value>
Each key represents a serial line. The following keys are available:
.RS
.TP 12n
.IP "\fBDTR - Data Terminal Ready"
.IP "\fBRTS - Request To Send"
.IP "\fBCTS - Clear To Send"
.IP "\fBDSR - Data Set Ready"
.IP "\fBDCD - Data Carrier Detect"
.IP "\fBRI - Ring Indicator"
.P
If defining more than one key value pair, the pairs must be comma separated.
The default pulse duration for each line is 100 ms.
.RE
.TP
.BR \-n ", " \-\-no\-autoconnect
@ -211,22 +228,20 @@ Send serial break (triggers SysRq on Linux, etc.)
Show configuration (baudrate, databits, etc.)
.IP "\fBctrl-t e"
Toggle local echo mode
.IP "\fBctrl-t g"
Toggle serial port line
.IP "\fBctrl-t h"
Toggle hexadecimal mode
.IP "\fBctrl-t l"
Clear screen
.IP "\fBctrl-t L"
Show line states (DTR, RTS, CTS, DSR, DCD, RI)
.IP "\fBctrl-t p"
Pulse serial port line
.IP "\fBctrl-t q"
Quit
.IP "\fBctrl-t s"
Show TX/RX statistics
.IP "\fBctrl-t L"
Show line states (DTR, RTS, CTS, DSR, DCD, RI)
.IP "\fBctrl-t d"
Toggle DTR
.IP "\fBctrl-t D"
Pulse DTR
.IP "\fBctrl-t r"
Toggle RTS
.IP "\fBctrl-t t"
Toggle line timestamp mode
.IP "\fBctrl-t U"
@ -273,7 +288,7 @@ Any options set via command-line will override options set in the configuration
.PP
The following configuration file options are available:
.TP 20n
.TP 21n
.IP "\fBpattern"
Pattern matching user input. This pattern can be an extended regular expression with a single group.
.IP "\fBtty"
@ -292,8 +307,8 @@ Set parity
Set output character delay
.IP "\fBoutput-line-delay"
Set output line delay
.IP "\fBdtr-pulse-duration"
Set DTR pulse duration
.IP "\fBline-pulse-duration"
Set line pulse duration
.IP "\fBno-autoconnect"
Disable automatic connect
.IP "\fBlog"
@ -333,7 +348,7 @@ databits = 8
parity = none
stopbits = 1
color = 10
dtr-pulse-duration = 50
line-pulse-duration = DTR=200,RTS=400
.ec
.fi
.RE