Commit graph

240 commits

Author SHA1 Message Date
Martin Lund
51bfa68bdd Text cleanup 2024-04-20 14:03:38 +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
a8e0d2693d Do not echo CR in line input and hex output mode 2024-04-18 14:44:39 +02:00
Martin Lund
c440da2ea8 Improve switched messages 2024-04-18 13:35:09 +02:00
Martin Lund
f1144ca5cc Cleanup 2024-04-18 13:29:06 +02:00
Martin Lund
a605533213 Fix local echo in line mode 2024-04-17 16:17:20 +02:00
Martin Lund
1e20948d83 Fix line input mode
Do not forward input characters to tty device before a line is input via
carriage return.
2024-04-16 19:38:45 +02:00
Martin Lund
4801816357 Introduce basic line input mode 2024-04-16 17:42:34 +02:00
Martin Lund
c4878a90d7 Clean up file descriptor name shadowing 2024-04-14 10:42:22 +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
fca76a017d Fix text alignment 2024-04-12 21:15:36 +02:00
Martin Lund
0afae5d3ee Update text 2024-04-12 13:03:51 +02:00
Martin Lund
d8fb1ab0ca Rework x/y-modem transfer command
Remove ctrl-t X optin and instead introduce submenu to ctrl-t x option
for picking which xmodem protocol to use.
2024-04-10 19:56:21 +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
Mengsk
eea46a2005 Add Xmodem-CRC support. 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
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
6fee8514f4 Invert line states to reflect true electrical level 2024-03-30 16:31:45 +01: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
Sylvain LAFRASSE
4269ec835d Fix double call of tty_disconnect() on macOS/Darwin. 2024-01-12 12:11:24 +01:00
Martin Lund
e572255fd2 Fix file descriptor handling on MacOS 2024-01-11 20:36:17 +01:00
HiFiPhile
72399c4fe6
CYGWIN: Fix port auto connection. (#211) 2023-09-22 11:53:37 +02:00
Martin Lund
a42f3f78d1 Overwrite old stale letters on xmodem filename input
When entering a file name, eg. 'test' it whould output the following
with 2 stale letters of the former input string:

[14:41:58.987] Send file with XMODEM
[14:42:08.015] Sending file 'test'st
[14:42:08.015] Press any key to abort transfer

To avoid this we simply overwrite the 2 stale letters with whitespaces.
2023-09-16 14:51:34 +02:00
Martin Lund
ed0386d2c4 Re-adjust max line size
So it stays within maximum size handled by xmodem.
2023-09-16 13:14:55 +02:00
Martin Lund
07864a0e78 Increase line buffer size
Just to make sure we accept very long filenames.
2023-09-16 12:25:38 +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
HiFiPhile
d9dc1ff698 tty_stdin_input_thread(): write to pipe only if byte_count > 0. 2023-09-14 00:06:46 +02:00
HiFiPhile
5c441f22c2 Ignore EINTR error. 2023-09-13 22:45:11 +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
Braden Young
afc9e3be5b Move map variables to tty to keep them all in one spot 2023-04-14 15:00:03 -07:00
Braden Young
5651c1c5d7 Configure socket mapping flags from tty parsing logic. Remove duplicate parsing logic in socket 2023-04-14 13:08:48 -07:00
Peter van Dijk
0cdc3ce045 use right /dev/ path on Haiku 2023-03-10 23:58:52 +00:00
Martin Lund
f6905b4213 Update tty device listing configuration
Cleanup and add FreeBSD tty device listing support.
2023-02-28 17:57:10 +01:00
Martin Lund
2915d26a19 Fix double prefix key regression 2022-12-05 16:27:53 +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
12f20c84e3 Fix so that is it possible to quit tio in tio etc.
Fix regression so that it is possible to send the prefix key code to the
remote tio session without local tio session reacting to same key code
(quitting etc.).
2022-11-28 14:30:54 +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
a4f0d4da53 Add socket input comment 2022-11-21 17:16:14 +01:00
Martin Lund
6f9e41152b Update show config 2022-10-19 22:18:25 +02:00
Martin Lund
c8aeba7ef8 Fix output line delay
Apply output line delay on lines ending with \n.

On most systems lines ends with \n or \r\n.
2022-10-11 12:12:40 +02:00
Martin Lund
a65b5b0e3a Do not print timestamps in hex mode 2022-09-29 20:50:12 +02:00
Martin Lund
5f14924c96 Improve input mechanism in hex mode
Print the 2 character hex code that you input in hex mode but then
delete it before sending. This way it is easier to keep track of what
you are inputting. It basically mimics the ctrl-shift-u input mechanism
that is used to input unicode.
2022-09-29 20:18:36 +02:00
Attila Veghelyi
5b8f33bd78 Add bit reverse order feature 2022-09-29 15:42:44 +02:00
Martin Lund
ab885713b9 Add support for sending prefix character to serial device
Do so by inputting prefix key twice, e.g. input ctrl-t ctrl-t to send
ctrl-t character to serial device.
2022-09-11 22:17:29 +02:00
Martin Lund
6618642acf Fix tty path on MSYS/CYGWIN platforms 2022-09-11 13:38:13 +02:00
Martin Lund
ba2d49d2f7 Consolidate timestamp implementation in one file 2022-09-10 23:29:23 +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