A serial device I/O tool
Changes since tio v1.46:
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.
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.
Avoid invalid hex character messages when switching hex mode
Force flushing of log writes
Renamed tty_flush() to tty_sync()
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.
Clean up tty_flush()
Force frequent sync on tty_flush()
Update README
Update example tiorc
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.
Make sure we flush output buffer to tty when piping to tio
Do not return false read error when piping to tio
Show error message when reading port settings fail
Victor Oliveira
Changes since tio v1.45:
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
Upgrade inih wrap to r56
Optimization
Add example configuration file
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.
Update README
Change 'ctrl-t T' to 'ctrl-t t' for timestamp toggle
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
Add plaintext man page
Rui Chen:
docs: add homebrew installation note
fix macOS build
fix compilation error
Changes since tio v1.43:
Simplify arbitrary baudrate code
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.
Update README
Clean up man page
Add support for space parity
Rename EOL delay to Output line delay
Replace -U,--upcase with mapping flag OLTU
Simplify tty_write()
Robert Snell:
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.
Changes since tio v1.42:
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.
Improve description of socket option
Rename ChangeLog to NEWS
Update README
Update man page
George Joseph:
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.
Changes since tio v1.41:
ZeroMemoryEx:
Sylvain LAFRASSE:
Changes since tio v1.40:
Rename --hex-mode to --hexadecimal
Enable buffered writing
Read block of bytes from input and process same block for output. This will speed things up by reducing I/O overhead.
Enable buffered reading
Read block of bytes from input and process byte by byte for output. This will speed things up by reducing I/O overhead.
Refactoring
Cleanup stdout flushing
Flushing is not needed since we disabled buffering of stdout.
Simplify stdout_configure() code
Simplify stdin_configure() code
Update man page
Update README
Changes since tio v1.39:
Add config support for log-strip
Add config support for hex-mode
Rename --hex to --hex-mode
Fix completion for -e, --local-echo
Ignore newlines in hex output
Fix newline in warning_printf()
Fix ansi_printf_raw() in no color mode
Enter non-interactive mode when piping to tio
Add support for a non interactive mode which allows other application to pipe data to tio which then forwards the data to the connected serial device.
Non ineractive means that tio does not react to interactive key commands in the incoming stream. This allows users to pipe binary data directly to the connected serial device.
Example use:
$ cat commands.txt | tio /dev/ttyUSB0
Also strip backspace from log
To make log strip feature consistent so that we remove all unprintable control characters and escape sequences.
Socket code cleanup
Cleanup man page
Rename --log-filename to --log-file
Yin Fengwei:
Allow strip escape sequence characters from log file
The log without escape key stripped is like:
^M[12:47:17] ACRN:> ^M[12:47:17] ACRN:>lasdfjklsdjf ^M ^M[12:47:18] Error: Invalid command. ^M[12:47:19] ACRN:> ^M[12:47:26] ACRN:> ^M[12:47:26] ACRN:>sdafkljsdkaljfklsadjflksdjafjsda^H ^H^H... ^M ^M[12:47:31] Error: Invalid command.
After strip escape key, the log is like:
[12:49:18] ACRN:> [12:49:19] ACRN:> [12:49:19] ACRN:>ls
[12:49:19] Error: Invalid command. [12:49:19] ACRN:> [12:49:19] ACRN:>dfaslhj
[12:49:24] Error: Invalid command.
Beside escape key, it also handle backspace key as well.
Changes since tio v1.38:
Improve key command response for local echo and timestamp
Fix invalid hex character error message
Make sure only matched config section is parsed
Add support for "disable" keyword in config file
Unify error message formating
Cleanup list devices code
Fix command-line tty-device|config parsing
Allow user to add options on both sides of the provided config argument.
For example:
$ tio -b 9600 am64-evm -e
Before, tio only allowed adding arguments after the config argument.
Implemented as simple as possible by introducing two stage option parsing.
Update bash completion
Add support for IPv4 and IPv6 network sockets
Add support for IPv4 and IPv6 network sockets via socket syntax
"inet:
For example, to listen and redirect serial device I/O to a host bound IPv4 socket simply do:
$ tio /dev/ttyUSB0 --socket inet:4444
To connect do e.g.:
$ nc 127.0.0.1 4444
Likewise, for IPv6 do:
$ tio /dev/ttyUSB0 --socket inet6:4444
To connect do e.g.:
$ nc ::1 4444
If port is 0 or no port is provided default port 3333 is used.
Fix tio deleting unix socket file
If tio has a unix file socket open, a second tio instance of tio may delete the socket file. This change fixes so that it will not be deleted and tio will instead error and complain about conflicting socket file.
Rework color option
Rework the color option to support setting ANSI color code values ranging from 0..255 or "none" for no color or "list" to print a list of available ANSI colors codes.
Also, disables color when piping.
Remove print of hex mode status at startup
Remove newline option in hex mode
Fix configfile memory leaks
Remove command-line option inconsistencies
Optional arguments, as parsed by the getopt_long mechanism, are inherently inconsistent with how you define required arguments.
To avoid confusion we decide to avoid this inconsistency by replacing optional options with additional options with required argmuments.
Replace '1' with 'enable' in config files
Convert errors to warnings
g0mb4:
Extended hexadecimal mode.
While in hex mode (ctrl-t h) you can output hexadecimal values. E.g.: to send 0x0A you have to type 0A (always 2 characters).
Added option -x, --hex to start in hexadecimal mode.
Added option --newline-in-hex to interpret newline characters in hex mode. This is disabled by default, because, in my opinion, hex stream is fundamentally different from text, so a "new line" is meaningless in this context.
Changes since tio v1.37:
Redirect error messages to stderr
Improve help and man page
Mention config file in --help
Fix running without config file
Fix config file error messages
Redirect error messages to stderr
Add repology packaging status
Fix parsing of default settings
Default configuration file settings were not parsed in case a section was matched. Now we make sure that the default (unnamed) settings are always parsed.
Append to existing log file (no truncation)
Add socket info to show configuration
Print socket info at startup
Fix socket option parsing
Peter Collingbourne:
Match user input against config section names if pattern matching was unsuccessful.
This allows for better config file ergonomics if the user has a diverse set of serial devices as the name does not need to be specified in the config file twice.
Add support for external control via a Unix domain socket.
This feature allows an external program to inject output into and listen to input from a serial port via a Unix domain socket (path specified via the -S/--socket command line flag, or the socket config file option) while tio is running. This is useful for ad-hoc scripting of serial port interactions while still permitting manual control. Since many serial devices (at least on Linux) get confused when opened by multiple processes, and most commands do not know how to correctly open a serial device, this allows a more convenient usage model than directly writing to the device node from an external program.
Any input from clients connected to the socket is sent on the serial port as if entered at the terminal where tio is running (except that ctrl-t sequences are not recognized), and any input from the serial port is multiplexed to the terminal and all connected clients.
Sockets remain open while the serial port is disconnected, and writes will block.
Example usage 1 (issue a command):
echo command | nc -UN /path/to/socket > /dev/null
Example usage 2 (use the expect command to script an interaction):
#!/usr/bin/expect -f
set timeout -1 log_user 0
spawn nc -UN /path/to/socket set uart $spawn_id
send -i $uart "command1\n" expect -i $uart "prompt> " send -i $uart "command2\n" expect -i $uart "prompt> "
lexaone: