Remove options --response-wait, --response-timeout

Remove options and rework input handling so it is possible to do the
same thing but via script which is much more flexible.

These options were always a bit of a hardcoded solution. With the new
script expect feature we can wait for any type of response.

For example, pipe command to serial device and wait for line response within 1 second:

$ echo "*IDN?" | tio /dev/ttyACM0 --script "expect('\r\n', 1000)" --mute
This commit is contained in:
Martin Lund 2024-04-13 23:16:31 +02:00
parent e1e3e298bf
commit 97537853a8
9 changed files with 46 additions and 116 deletions

View file

@ -245,21 +245,6 @@ If port is 0 or no port is provided default port 3333 is used.
At present there is a hardcoded limit of 16 clients connected at one time.
.RE
.TP
.BR \-r ", " \-\-response\-wait
Wait for line response then quit. A line is considered any string terminated
with a NL character. If no line is received tio will quit after response
timeout.
Any tio text is automatically muted when piping a string to tio while in
response mode to make it easy to parse the response.
.TP
.BR " \-\-response\-timeout " \fI<ms>
Set timeout [ms] of line response (default: 100).
.TP
.BR " \-\-rs\-485"
@ -494,10 +479,6 @@ Set output mode.
Set socket to redirect I/O to
.IP "\fBprefix-ctrl-key"
Set prefix ctrl key (a..z or 'none', default: t)
.IP "\fBresponse-wait"
Enable wait for line response
.IP "\fBresponse-timeout"
Set line response timeout
.IP "\fBrs-485"
Enable RS-485 mode
.IP "\fBrs-485-config"
@ -648,11 +629,10 @@ Pipe command to the serial device:
$ echo "ls -la" | tio /dev/serial/by\-id/usb\-FTDI_TTL232R-3V3_FTGQVXBL\-if00\-port0
.TP
Pipe command to the serial device and wait for line response (string ending with CR or NL):
Pipe command to serial device and wait for line response within 1 second:
$ echo "*IDN?" | tio /dev/ttyACM0 --response-wait
$ echo "*IDN?" | tio /dev/ttyACM0 --script "expect('\\r\\n', 1000)" --mute
.TP
In this mode, only the response will be printed.
.TP
Likewise, to pipe data from file to the serial device: