Commit graph

223 commits

Author SHA1 Message Date
Martin Lund
2db87ede53 Update README 2024-04-12 22:21:35 +02:00
Martin Lund
fc54df1f22 Add lua expect(string)
Add simple expect functionality.

The expect(string) function will wait for input from the tty device and
only return when there is a string match. Regular expressions are
supported.

Example:

script = expect('password:'); send('my_password\n')
2024-04-12 18:20:33 +02:00
Martin Lund
0afae5d3ee Update text 2024-04-12 13:03:51 +02:00
Martin Lund
e028544cd0 Update plain text man page 2024-04-12 00:24:01 +02:00
Martin Lund
5eb649278a Clean up man page 2024-04-12 00:23:04 +02:00
Martin Lund
418a43d96e Add lua send(string) 2024-04-12 00:08:45 +02:00
Martin Lund
00c8124a0a Add lua modem_send(file,protocol) 2024-04-11 21:20:50 +02:00
Martin Lund
2fff4d36d0 Add independent input and output mode
Replaces -x, --hexadecimal option with --intput-mode and --output-mode
so it is possible to select hex or normal mode for both input and output
independently.

To obtain same behaviour as -x, --hexadecimal use the following
configuration:

input-mode = hex
output-mode = hex
2024-04-10 14:40:18 +02:00
HiFiPhile
fd6a246908 Add manpage. 2024-04-09 14:58:17 +02:00
Martin Lund
3e50191107 Add tty line configuration script API
On some platforms calling high()/low() to switch line states result in
costly system calls whick makes it impossible to swith two or more tty
lines simultaneously.

To help solve this timing issue we introduce a tty line state
configuration API which can be used instead of using
high()/low().

Using config_low(line) and config_high(line) one can set up a new line
state configuration for multiple lines and then use config_apply() to
finally apply the configuration. This will result in only one system
call to instruct the serial port drive to switch all the configured line
states which should help ensure that the lines are switched
simultaneously.

Example:

script = config_high(DTR); config_low(RTS); config_apply()
2024-04-06 09:34:25 +02:00
Martin Lund
4369d5b66f Add ONULBRK mapping flag
Add ONULBRK mapping to map nul (zero) to send break signal on output.

This is useful if one needs to e.g. send the break signal to the tty
device when connected via socket.
2024-04-05 13:55:51 +02:00
Martin Lund
70913fe120 Add --log-directory option
For specifying directory path in which to save automatically named log
files.
2024-04-04 12:31:55 +02:00
Martin Lund
0becfa3274 Add Lua scripting feature
Add support for running Lua scripts that can manipulate the tty control
lines. Script is activated automatically on connect or manually via in
session key command.

The Lua scripting feature opens up for many posibilities in the future
such as adding expect like functionality to easily and programatically
interact with the connected device.
2024-04-01 15:37:40 +02:00
Martin Lund
593f9495f4 Add support for disabling prefix key handling
To disable prefix key input handing simply set prefix-ctrl-key to
'none'.

Based on original patch from Sebastian Krahmer.
2024-02-19 16:51:02 +01:00
Fredrik Svedberg
58c9489b92 Add map FF to ESC-c on input
Added map of form feed to ESC-c on input for terminals that
do not clear screen on ^L but do on ESC-c.
2024-02-12 22:22:20 +01:00
Jakob Haufe
ed66c72ca1
Fix troff warning (#216)
.eo/.ec sections seemingly need explicit empty lines using .sp

Otherwise, troff complains:

troff:<standard input>:535: warning: expected numeric expression, got '\'
troff:<standard input>:538: warning: expected numeric expression, got '\'
troff:<standard input>:541: warning: expected numeric expression, got '\'
2023-12-08 10:43:37 +01:00
Martin Lund
1777206de7 Update plain text man page 2023-09-21 08:47:34 +02:00
pnrhub
e6ffbd9058
Add xmodem and ymodem file send support (#208)
* Add xmodem and ymodem file send support
---------

Co-authored-by: pnr <pnr@home25.nl>
2023-09-16 12:17:38 +02:00
Martin Lund
3c7c865e59 Update man page 2023-09-07 00:55:52 +02:00
Wes Koerber
5656381cc3 chore: update readme, bash completion, man page 2023-07-13 20:58:01 -04:00
Martin Lund
148a3c1da1 Add --log-append option
Add --log-append option which makes tio append to any existing log file.

This also changes the default behaviour of tio from appending to
overwriting any existing log file. Now you have to use this new option
to make tio append.
2023-04-28 20:50:34 +02:00
Martin Lund
3bedd85e7c Update man page 2023-04-27 10:13:57 +02:00
Martin Lund
8fe5dde4b8 Fix line termination for response wait feature
The response wait feature waited for a line response, a string
terminated with either CR or NL. However, some devices may send a CR and
then their line content and then NL. This means tio will quit before
receiving and printing the line response. To solve this we simply ignore
the CR character and only consider lines terminated with a NL character.

This should work for all devices as lines are AFAIK always terminated
with either CRNL or a NL.
2023-04-20 17:28:43 +02:00
Martin Lund
c6f319ecb0 Mention which keystrokes are forwarded 2023-01-12 00:08:27 +01:00
Martin Lund
4782faf47f Update plain text man page 2023-01-05 08:23:09 +01:00
Martin Lund
4a1c213409 Update man page 2023-01-05 08:20:44 +01:00
Martin Lund
a2bbab0684 Update plain text man page 2022-12-17 17:11:22 +01:00
Martin Lund
4e9d29c88d Add support for $HOME/.tioconfig
Replaces what used to be $HOME/.tiorc
2022-12-07 04:10:56 +01:00
Vyacheslav Patkov
42739c0817 Better error checking in config file, rename the file
Accept "true", "enable", "on", "yes", "1" as true values, their
counterparts as false ones. Check integer values for errors and range.
Warn about ignored (e.g. misspelled) options.

Check getenv() return value for NULL.

Rename "tiorc" to "config", as it's a static INI file, not an executable
"run commands".
2022-12-06 20:27:14 +04:00
Martin Lund
6b084a53b8 Update version tag date 2022-12-02 13:05:00 +01:00
Martin Lund
a21809b090 Update plain text man page 2022-12-02 12:59:51 +01:00
Martin Lund
cd24797961 Update flush command 2022-12-02 12:45:45 +01:00
Martin Lund
93e6efc001 Add threaded input handling
To make tio more responsive to quit and I/O flush key command when main I/O
thread is blocked on output.
2022-11-28 14:44:32 +01:00
Martin Lund
419fbdc3fa Add key command to toggle log on/off
Add key command 'ctrl-t f' which will toggle log on/off.

If no log filename has been specified via the 'log-filename' option then
tio will automatically generate a new log filename every time the log
feature is toggled on. Meaning, when toggled multiple times, multiple
log files will be generated.

However, if a log filename has been specified, tio will only write and
append to that same file.
2022-11-23 17:24:54 +01:00
Martin Lund
1aaecef419 Update plain text man page 2022-11-01 11:11:54 +01:00
Martin Lund
48a2298e81 Rename config variable 'tty' to 'device' 2022-10-19 22:29:33 +02:00
Martin Lund
a40097f837 Update man page 2022-10-18 15:28:59 +02:00
Martin Lund
14fc77ffc1 Update plain text man page 2022-10-15 00:58:47 +02:00
Attila Veghelyi
4924969268 Complete bit reorder feature for release 2022-09-29 17:33:35 +02:00
Martin Lund
fb89b79b30 Update man page 2022-09-16 13:47:29 +02:00
Martin Lund
61b204aa3d Update plain text man page 2022-09-11 11:58:18 +02:00
Martin Lund
16479c8d86 Cleanup 2022-09-11 11:55:19 +02:00
Martin Lund
278750428c Update plain text man page 2022-09-11 11:47:04 +02:00
Martin Lund
88588100e4 Update plain text man page 2022-09-10 22:46:58 +02:00
Martin Lund
989874ffb8 Cleanup 2022-09-10 22:39:36 +02:00
Martin Lund
dbc9a8e82d Add visual or audible alert support on connect/disconnect
The feature is detailed via the following option:

 --alert none|bell|blink

     Set alert action on connect/disconnect.

     It will sound the bell once or blink once on successful connect.
     Likewise it will sound the bell twice or blink twice on disconnect.

     Default value is "none" for no alert.
2022-09-10 22:33:42 +02:00
Martin Lund
ee46686fb6 Add experimental RS-485 support
Many modern RS-485 serial devices such as the ones from FTDI already
operate in RS-485 mode by default and will work with tio out of the box.
However, there are some RS-232/485 devices which need to be switched
from e.g. RS-232 to RS-485 mode to operate accordingly on the physical
level.

This commit implements the switching mechanism and interface required to
enable RS-485 mode. It only works on Linux and with serial devices which
use device drivers that support the Linux RS-485 control interface.

The RS-485 feature is detailed via the following options:

 --rs-485                           Enable RS-485 mode
 --rs-485-config <config>           Set RS-485 configuration

Set the RS-485 configuration using the following key or key value pair
format in the configuration field:

 RTS_ON_SEND=value             Set logical level (0 or 1) for RTS pin when sending
 RTS_AFTER_SEND=value          Set logical level (0 or 1) for RTS pin after sending
 RTS_DELAY_BEFORE_SEND=value   Set RTS delay (ms) before sending
 RTS_DELAY_AFTER_SEND=value    Set RTS delay (ms) after sending
 RX_DURING_TX                  Receive data even while sending data

If defining more than one key or key value pair, they must be comma
separated.

Example use:

 $ tio /dev/ttyUSB0 --rs-485 --rs-r485-config=RTS_DELAY_AFTER_SEND=50,RX_DURING_TX
2022-09-10 17:52:54 +02:00
Martin Lund
a58d406a3c Update list description 2022-09-08 09:32:51 +02:00
Martin Lund
fe6827bc7e Clean up man page 2022-08-30 01:11:27 +02:00
Martin Lund
e837fd0303 Add line response feature
Add a simple line response feature to make it possible to send e.g. a
command string to your serial device and easily receive and parse a line
response.

This is a convenience feature for simple request/response interaction
based on lines. For more advanced interaction the socket feature should
be used instead.

The line response feature is detailed via the following options:

 -r, --response-wait

Wait for line response then quit. A line is considered any string ending
with either CR or 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.

 --response-timeout <ms>

Set timeout [ms] of line response (default: 100).

Example:

Sending a string (SCPI command) to a test instrument (Korad PSU) and
print line response:

 $ echo "*IDN?" | tio /dev/ttyACM0 --response-wait
 KORAD KD3305P V4.2 SN:32477045
2022-08-15 19:58:28 +02:00