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
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.
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> "
Allow user to select which ANSI color code to use to colorize the tio
text. To successfully set the color the color code must be in the range
0..255.
If color code is negative tio will print all available ANSI colors.
The default color is changed to bold white to make tio defaults usable
for most users, including color blind users.
* Show milliseconds too in the timestamp (#114) and log file (#124)
* Change timestamp format to ISO-8601.
Co-authored-by: Attila Veghelyi <aveghelyi@dension.com>
Co-authored-by: Sylvain LAFRASSE <sly74fr@users.noreply.github.com>
This is to fix the issue #104. The timestamp will always be
printed at the beginning of line:
[10:25:56] Switched to hexadecimal mode
0d 0a 0d [10:25:57] 41 43 52 4e 3a 5c 3e 0d 0a 0d [10:25:58] 41
is changed to:
[12:34:56] 45 72 72 6f 72 3a 20 49 6e 76 61 6c 69 64 20
[12:34:56] 41 43 52 4e 3a 5c 3e
[12:34:56] 41 43 52 4e 3a 5c 3e
[12:34:57] 41 43 52 4e 3a 5c 3e 6c 73
In order for local echo to work properly, we have to either call
fflush(stdout) after every character or just disable line buffering.
This change calls fflush() after putchar().
Closes#92
In order for local echo to work properly, we have to either call
fflush(stdout) after every character or just disable line buffering.
This change uses setbuf(stdout, NULL) to do the latter.
Closes#92