Commit graph

495 commits

Author SHA1 Message Date
Martin Lund
463415d63b Remove duplicate show config entry of DTR pulse duration 2022-07-24 20:57:34 +02:00
Martin Lund
c3116b2b56 Enable log feature when using --log-filename
No reason to not assume that the user wants to enable log when the
--log-filename is used. This way uses can skip the use of --log to
enable log.
2022-07-23 10:40:35 +02:00
Martin Lund
a13fe254f2 Enable line buffering of log
Replace flushing/writing of log at every log write operation with line
buffering, meaning log will be written line by line to make it more I/O
friendly but still update frequently.
2022-07-23 09:53:12 +02:00
Martin Lund
d28007f0d3 Avoid invalid hex character messages when switching hex mode 2022-07-22 22:03:47 +02:00
Martin Lund
c24cbfcd34 Force flushing of log writes 2022-07-22 17:57:11 +02:00
Martin Lund
f454bdaa3a Cleanup 2022-07-22 16:40:15 +02:00
Martin Lund
b322ecbdcf Renamed tty_flush() to tty_sync() 2022-07-22 16:37:49 +02:00
Martin Lund
de606d51ba Fix sync output to serial port
Using fsync() on filedescriptors for serial ports can not be relied on.
Add use of tcdrain() to make sure data has been written by the serial
port before proceeding.

This fixes a problem with tio sometimes not writing piped input data to
the serial port before exiting which results in the pending writes being
cancelled / flushed.
2022-07-22 16:28:38 +02:00
Martin Lund
0cdd69940f Clean up tty_flush() 2022-07-22 00:45:30 +02:00
Martin Lund
dd8b137b15 Force frequent sync on tty_flush() 2022-07-22 00:16:54 +02:00
Martin Lund
6462aac792 Simplify tty_flush() 2022-07-20 20:46:01 +02:00
Martin Lund
5f46136b28 Quit from non-interactive mode using ctrl-c
When piping to tio it will automatically enter "non-interactive" mode
which means it will not react to any input key sequences but simple read
the input stream and write it to the tty device.

This also means that ctrl-t q can not be used to quit and so tio would
hang forever when used in non-interactive mode.

This change allows to send the standard termination signal by pressing
ctrl-c on tio in non-interactive mode to make it quit.
2022-07-20 18:18:16 +02:00
Martin Lund
eadcc7e384 Make sure we flush output buffer to tty when piping to tio 2022-07-20 17:56:43 +02:00
Martin Lund
a0a8dccd51 Do not return false read error when piping to tio 2022-07-20 13:11:11 +02:00
Martin Lund
40c8753151 Show error message when reading port settings fail 2022-07-20 12:25:51 +02:00
Martin Lund
e96d289718 Cleanup 2022-07-19 14:54:02 +02:00
Martin Lund
3903880106 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
2022-07-19 12:54:40 +02:00
Ralph Siemsen
34e95bb4a5 Fix relative timestamps
Fix the display of relative timestamps. The hack of subtracting 3600
only works if you happen to be in a time zone that is one hour away from
UTC. When subtracting two time values, the result is an absolute
quantity (interval). These should be displayed as-is; without local time
zone nor daylight saving correction. Hence gmtime() instead of
localtime().
2022-07-18 18:58:28 +02:00
Martin Lund
fc3e6c40ec Optimization 2022-07-17 09:34:03 +02:00
Martin Lund
9733bdf19c Introduce bold color option
Introduce "bold" color option which only apply bold color formatting to
existing system color.

Also make "bold" the default color option.

Fixes all white issue with black on white tio text.
2022-07-15 18:42:03 +02:00
Martin Lund
d510c101b4 Change 'ctrl-t T' to 'ctrl-t t' for timestamp toggle 2022-07-15 12:26:36 +02:00
Martin Lund
02729c10b1 Add support for remapping prefix key
Make it possible to remap the prefix key (default: ctrl-t) by setting
the prefix-ctrl-key variable in the configuration file.

Allowed values are in the range a..z.

Example, to set the prefix key to ctrl-a simply do:

prefix-ctrl-key = a
2022-07-15 12:18:40 +02:00
Martin Lund
00ae3b2fbd Update TODO 2022-07-14 11:13:22 +02:00
Rui Chen
223f0c5d13
fix compilation error
Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-07-13 22:09:07 -04:00
Martin Lund
dfcda015c3 Add missing include 2022-07-12 22:27:42 +02:00
Martin Lund
a23be7f2c2 Simplify arbitrary baudrate code 2022-07-12 12:09:09 +02:00
Martin Lund
ac859f41b9 Cleanup error printing routines
Clean up so that only the following error related printing functions are
used: tio_error_printf(), tio_error_printf_silent(),
tio_warning_printf().

A session mode switch is introduced for error printing so that it will
print error messages with better formatting depending on in or out of
session.
2022-07-11 23:18:19 +02:00
Martin Lund
360deb3c72 Add support for space parity 2022-07-11 14:55:54 +02:00
Martin Lund
39af74f263 Rename EOL delay to Output line delay 2022-07-11 14:08:12 +02:00
Martin Lund
8b8dd373a7 Cleanup 2022-07-11 10:51:17 +02:00
Martin Lund
11762b2300 Replace -U,--upcase with mapping flag OLTU 2022-07-11 10:15:12 +02:00
Martin Lund
555e526ce7 Cleanup 2022-07-11 09:18:43 +02:00
Martin Lund
5b82c710f1 Simplify tty_write() 2022-07-11 09:12:56 +02:00
Robert Snell
f459a462c5 Fixed indentation in configfile.c, tty.c, options.c 2022-07-10 18:14:29 -04:00
Robert Snell
1c29aac9fa fixed indentation in configfile.c 2022-07-10 14:06:22 -04:00
Robert Snell
944ee9173b Additional commands: EOL delay, lower to upper translation, added mark parity
Added command line options:
-O, --eol-delay to have a separate delay for end of line
-U, --upper to enable translation of lower case alpha to upper case

Added ability to set mark parity.
Added ctrl-t U key sequence to allow enable/disable lower case alpha to
upper case during a session.
Updated Man page with command line options, ctrl-t sequences and
configuration file options.
Updated README.md, with above information.
2022-07-09 21:22:43 -04:00
George Joseph
f24cee61e7 Add Pulse DTR command
MCUs like the ESP32 can be reset if the serial port DTR line is
pulsed for a short time.  You could just type CTRL-t d CTRL-t d
but that's a little awkward since you have to lift your finger
off the CTRL key to type the Ds.  Now you can just type CTRL-T D.

* Added new command "D" to pulse the DTR line.  I.E.  Toggle its
  state twice with a configurable duration between toggles.

* Added new config/command line option "--dtr-pulse-duration"
  to set the duration between the DTR state toggles.  The default
  is 100ms.
2022-07-07 12:45:29 -06:00
Martin Lund
a717631207 Improve description of socket option 2022-07-07 14:00:56 +02:00
Martin Lund
e53b69afbd Update doc 2022-07-06 16:25:15 +02:00
Martin Lund
dc1b3a3549 Cleanup 2022-07-06 13:40:56 +02:00
Martin Lund
72fd2f2980 Fix timestamp configuration state 2022-07-06 13:22:19 +02:00
Martin Lund
f83e81e5db Fix default timestamp 2022-07-05 18:57:03 +02:00
Martin Lund
6a1d4838da Update bash completion 2022-07-05 17:47:20 +02:00
Martin Lund
683aab1dc7 Do not expose timestamp-format 'none' option
Do not expose the 'none' timestamp-format option. It is and internal
state used when timestamp is disabled.
2022-07-05 17:34:49 +02:00
Martin Lund
d598fa76a7 Fix timestamp miliseconds bug 2022-07-05 17:00:32 +02:00
Martin Lund
a56db8744b Improve error message 2022-07-05 16:49:31 +02:00
Martin Lund
62d9b5fb5c Remove timestamp format warning 2022-07-05 16:37:10 +02:00
Martin Lund
732c0c3f89 Add '24hour-delta' timestamp option
When enabled this option will timestamp new lines with the time elapsed
since the line before.

This is a very useful feature to identify which events takes the most
time.
2022-07-05 16:05:38 +02:00
Martin Lund
eb24e7215b
Merge pull request #152 from sly74fr/feature/macos_socket_build
Add missing 'string.h' include.
2022-07-04 17:56:21 +02:00
Sylvain LAFRASSE
16d6807de7 Add missing 'string.h' include. 2022-07-04 17:34:38 +02:00