Commit graph

190 commits

Author SHA1 Message Date
Martin Lund
5e3722a10e Update man page 2024-04-29 16:09:37 +02:00
Martin Lund
6d77201ba0 Simplify lua line manipulation API
Collapses lua high(), low(), toggle(), config_high(), config_low(),
config_apply() into one simple function:

set{<line>=<state>, ...}

Line can be any of DTR, RTS, CTS, DSR, CD, RI.

State is high, low, or toggle.

Example:
script = set{DTR=high, RTS=low}; msleep(100); set{DTR=low, RTS=high}; msleep(100); set{RTS=low}

Notice the use of {} instad of () when calling the set function. This is
required to pass parameters by name in lua.
2024-04-29 15:20:53 +02:00
Martin Lund
33eae0c30d Update script API 2024-04-28 14:46:41 +02:00
Martin Lund
42ff234204 Add hexN output mode
Adds support for hexN mode where N is a number in the range 1 to 4096
which defines how many hex values will be printed before a line break.

In short, it defines the width of the hex output.

In this mode, if timestamps are enabled they will be added to each hex
line.
2024-04-27 15:25:34 +02:00
Martin Lund
232cbee697 Rename sub-config to profile
Because better naming.
2024-04-27 09:13:33 +02:00
Martin Lund
d19ba1c492 Add new ways to manage serial devices
* Rename --list-devices to --list

 * Rename --no-autoconnect to --no-reconnect

 * Switch -l and -L options

   * -l now lists available serial devices

   * -L enables log to file

 * Add option --auto-connect <strategy>

   * Supported strategies:

     * "new" - Waits to connect first new appearing serial device

     * "latest" - Connects to latest registered serial device

     * "direct" - Connect directly to specified serial device (default)

 * Add options to exclude serial devices from auto connect strategy by
   pattern

   * Supported exclude options:

     * --exclude-devices <pattern>

       Example: '--exclude-devices "/dev/ttyUSB2,/dev/ttyS?"'

     * --exclude-drivers <pattern>

       Example: '--exclude-drivers "cdc_acm"'

     * --exclude-tids <pattern>

       Example: '--exclude-tids "yW07,bCC2"'

     * Patterns support '*' and '?'

 * Connect to same port/device combination via unique topology ID (TID)

   * Topology ID is a 4 digit base62 encoded hash of a device topology
     string coming from the Linux kernel. This means that whenever you
     plug in the same e.g. USB serial port device to the same USB hub
     port connected via the exact same hub topology all the way to your
     computer, you will get the same unique TID.

   * Useful for stable reconnections when serial device has no serial
     device by ID

   * For now, only tested on Linux.

 * Reworked and improved listing of serial devices to show serial devices:

   * By device

     * Including TID, uptime, driver, and description.

     * Sorted by uptime (newest device listed last)

   * By unique topology ID

   * By ID

   * By path

 * Add script interface 'list = tty_search()' for searching for serial
   devices.
2024-04-26 22:19:22 +02:00
Martin Lund
fa4207ddfd Update description of mute option 2024-04-19 20:14:22 +02:00
Martin Lund
6fff4939e4 Add timeout based timestamps in hex output mode
This change reintroduces timestamping in hex output mode but based on
timeout instead of new lines which made no sense. This means that
timestamps will only be printed when timeout time has elapsed with no
output activity from serial device.

Adds option --timestamp-timeout <ms> for setting the timeout value in
milliseconds.

Defaults to 200 ms.
2024-04-18 15:52:45 +02:00
Martin Lund
3cc2d90fda Extend lua expect() to also return matched string 2024-04-17 23:38:21 +02:00
Davis C
1cefb7b6bc Revert "Added reset_buffer()"
This reverts commit ee56d1280d.
2024-04-17 18:13:00 +02:00
Davis C
794c5202f4 Added reset_buffer() 2024-04-17 18:13:00 +02:00
Martin Lund
4801816357 Introduce basic line input mode 2024-04-16 17:42:34 +02:00
Martin Lund
10eedd4ad2 Update README 2024-04-14 02:32:25 +02:00
Martin Lund
a1a4dc4642 Update plain text man page 2024-04-14 01:42:43 +02:00
Martin Lund
97537853a8 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
2024-04-13 23:18:25 +02:00
Martin Lund
e1e3e298bf Add lua exit(code) 2024-04-13 16:46:00 +02:00
Martin Lund
51300cc4f0 Add timeout feature to expect() 2024-04-13 15:30:14 +02:00
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