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

@ -32,7 +32,7 @@ when used in combination with [tmux](https://tmux.github.io).
* List available serial devices by ID
* Show RX/TX statistics
* Toggle serial lines
* Pulse the DTR line
* Pulse serial lines with configurable duration
* Local echo support
* Map characters (nl, cr-nl, bs, lowercase to uppercase, etc.)
* Line timestamps
@ -72,7 +72,7 @@ The command-line interface is straightforward as reflected in the output from
-p, --parity odd|even|none|mark|space Parity (default: none)
-o, --output-delay <ms> Output character delay (default: 0)
-O, --output-line-delay <ms> Output line delay (default: 0)
--dtr-pulse-duration <ms> DTR pulse duration (default: 100)
--line-pulse-duration <duration> Set line pulse duration
-n, --no-autoconnect Disable automatic connect
-e, --local-echo Enable local echo
-t, --timestamp Enable line timestamp
@ -131,16 +131,14 @@ ctrl-t ? to list the available key commands.
[20:19:12.040] ctrl-t ? List available key commands
[20:19:12.040] ctrl-t b Send break
[20:19:12.040] ctrl-t c Show configuration
[20:19:12.040] ctrl-t d Toggle DTR line
[20:19:12.040] ctrl-t D Pulse DTR line
[20:19:12.040] ctrl-t e Toggle local echo mode
[20:19:12.040] ctrl-t g Toggle serial port line
[20:19:12.040] ctrl-t h Toggle hexadecimal mode
[20:19:12.040] ctrl-t l Clear screen
[20:19:12.040] ctrl-t L Show line states
[20:19:12.040] ctrl-t p Pulse serial port line
[20:19:12.040] ctrl-t q Quit
[20:19:12.040] ctrl-t r Toggle RTS line
[20:19:12.041] ctrl-t s Show statistics
[20:19:12.041] ctrl-t t Send ctrl-t key code
[20:19:12.041] ctrl-t T Toggle line timestamp mode
[20:19:12.041] ctrl-t U Toggle conversion to uppercase
[20:19:12.041] ctrl-t v Show version
@ -169,7 +167,6 @@ databits = 8
parity = none
stopbits = 1
color = 10
dtr-pulse-duration = 50
[rpi3]
tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
@ -177,6 +174,7 @@ baudrate = 115200
no-autoconnect = enable
log = enable
log-file = rpi3.log
line-pulse-duration = DTR=200,RTS=150
color = 12
[usb devices]