tio/man/tio.1.in
2022-06-17 11:00:42 +02:00

338 lines
7.6 KiB
Groff

.TH "tio" "1" "@version_date@" "tio @version@" "User Commands"
.SH "NAME"
tio \- a simple serial device I/O tool
.SH "SYNOPSIS"
.PP
.B tio
.RI "[" <options> "] " "<tty-device|config>"
.SH "DESCRIPTION"
.PP
.B tio
is a simple serial device tool which features a straightforward command-line
interface to easily connect to serial TTY devices for basic I/O operations.
.SH "OPTIONS"
.TP
.BR \-b ", " "\-\-baudrate " \fI<bps>
Set baud rate [bps] (default: 115200).
.TP
.BR \-d ", " "\-\-databits 5" | 6 | 7 | 8
Set data bits (default: 8).
.TP
.BR \-f ", " "\-\-flow hard" | soft | none
Set flow control (default: none).
.TP
.BR \-s ", " "\-\-stopbits 1" | 2
Set stop bits (default: 1).
.TP
.BR \-p ", " "\-\-parity odd" | even | none
Set parity (default: none).
.TP
.BR \-o ", " "\-\-output\-delay " \fI<ms>
Set output delay [ms] inserted between each sent character (default: 0).
.TP
.BR \-n ", " \-\-no\-autoconnect
Disable automatic connect.
By default tio automatically connects to the provided device if present. If the device is not present, it will wait for it to appear and then connect. If the connection is lost (eg. device disconnects), it will wait for the device to reappear and then reconnect.
However, if the
.B \-\-no\-autoconnect
option is provided, tio will exit if the device is not present or an established connection is lost.
.TP
.BR \-e ", " "\-\-local\-echo
Enable local echo.
.TP
.BR \-t ", " \-\-timestamp
Enable line timestamp.
.TP
.BR " \-\-timestamp-format \fI<format>
Set timestamp format to any of the following timestamp formats:
.RS
.TP 16n
.IP "\fB24hour"
24-hour format ("hh:mm:ss.sss")
.IP "\fB24hour-start"
24-hour format relative to start time
.IP "\fBiso8601"
ISO8601 format ("YYYY-MM-DDThh:mm:ss.sss")
.P
Default format is
.B 24hour
.RE
.TP
.BR \-L ", " \-\-list\-devices
List available serial devices.
.TP
.BR \-l ", " \-\-log
Enable log to file. If no filename is provided the filename will be automatically generated.
.TP
.BR " \-\-log-file \fI<filename>
Set log filename.
.TP
.BR " \-\-log-strip
Strip control characters and escape sequences from log.
.TP
.BR \-m ", " "\-\-map " \fI<flags>
Map (replace, translate) special characters on input or output. The following mapping flags are supported:
.RS
.TP 12n
.IP "\fBICRNL"
Map CR to NL on input (unless IGNCR is set).
.IP "\fBIGNCR"
Ignore CR on input.
.IP "\fBINLCR"
Map NL to CR on input.
.IP "\fBINLCRNL"
Map NL to CR-NL on input.
.IP "\fBOCRNL"
Map CR to NL on output.
.IP "\fBODELBS"
Map DEL to BS on output.
.IP "\fBONLCRNL"
Map NL to CR-NL on output.
.P
If defining more than one flag, the flags must be comma separated.
.RE
.TP
.BR \-x ", " \-\-hex\-mode
Enable hexadecimal mode.
.TP
.BR \-c ", " "\-\-color " \fI0..255|none|list
Colorize tio text using ANSI color code value ranging from 0 to 255 or use "none" for no color.
Use "list" to print a list of available ANSI color codes.
Default value is 15.
.TP
.BR \-S ", " "\-\-socket \fI<socket>\fR\fB
Listen on socket. 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
.B 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.
The following socket types are supported using different prefixes in the socket field:
.RS
.TP 20n
.IP "\fBunix:<filename>"
Unix Domain Socket (file)
.IP "\fBinet:<port>"
Internet Socket (network)
.IP "\fBinet6:<port>"
Internet IPv6 Socket (network)
.P
If port is 0 or no port is provided default port 3333 is used.
.P
At present there is a hardcoded limit of 16 clients connected at one time.
.RE
.TP
.BR \-v ", " \-\-version
Display program version.
.TP
.BR \-h ", " \-\-help
Display help.
.SH "KEYS"
.PP
.TP 16n
In session, the following key sequences are intercepted as tio commands:
.IP "\fBctrl-t ?"
List available key commands
.IP "\fBctrl-t b"
Send serial break (triggers SysRq on Linux, etc.)
.IP "\fBctrl-t c"
Show configuration (baudrate, databits, etc.)
.IP "\fBctrl-t e"
Toggle local echo mode
.IP "\fBctrl-t h"
Toggle hexadecimal mode
.IP "\fBctrl-t l"
Clear screen
.IP "\fBctrl-t q"
Quit
.IP "\fBctrl-t s"
Show TX/RX statistics
.IP "\fBctrl-t t"
Send ctrl-t key code
.IP "\fBctrl-t L"
Show line states (DTR, RTS, CTS, DSR, DCD, RI)
.IP "\fBctrl-t d"
Toggle DTR
.IP "\fBctrl-t r"
Toggle RTS
.IP "\fBctrl-t v"
Show version
.SH "HEXADECIMAL MODE"
.TP
In hexadecimal mode each incoming byte is printed out as a hexadecimal value.
.TP
Bytes can be sent in this mode by typing the \fBtwo-character hexadecimal\fR representation of the value, e.g.: to send \fI0xA\fR you must type \fI0a\fR or \fI0A\fR.
.SH "CONFIGURATION"
.PP
.TP 16n
Options can be set via a configuration file using the INI format. tio uses the configuration file first found in the following locations in the order listed: $XDG_CONFIG_HOME/tio/tiorc, $HOME/.config/tio/tiorc, $HOME/.tiorc
.TP
Config sections can be used to group settings.
.TP
.TP
tio will try to match the user input to a config section by name or by pattern to get the tty and other options.
.TP
Options without any config section name sets the default options.
.TP
The following configuration file options are available:
.TP 20n
.IP "\fBpattern"
Pattern matching user input. This pattern can be an extended regular expression with a single group.
.IP "\fBtty"
tty device to open. If tty contains a "%s" it will be substituted with the first group match.
.IP "\fBbaudrate"
Set baud rate
.IP "\fBdatabits"
Set data bits
.IP "\fBflow"
Set flow control
.IP "\fBstopbits"
Set stop bits
.IP "\fBparity"
Set parity
.IP "\fBoutput-delay"
Set output delay
.IP "\fBno-autoconnect"
Disable automatic connect
.IP "\fBlog"
Enable log to file
.IP "\fBlog-file"
Set log filename
.IP "\fBlog-strip"
Enable strip of control and escape sequences from log
.IP "\fBlocal-echo"
Enable local echo
.IP "\fBtimestamp"
Enable line timestamp
.IP "\fBtimestamp-format"
Set timestamp format
.IP "\fBmap"
Map special characters on input or output
.IP "\fBcolor"
Colorize tio text using ANSI color code ranging from 0 to 255
.IP "\fBhex-mode"
Enable hexadecimal mode
.IP "\fBsocket"
Set socket to listen on
.SH "CONFIGURATION EXAMPLES"
.TP
A typical config section used as a short-hand would be defined as such:
.RS
.nf
.eo
[ftdi]
baudrate=115200
tty=/dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
color=11
.ec
.fi
.RE
.TP
With this config section defined in the configuration file the following commands would be equivalent:
$ tio ftdi
$ tio -b 115200 -c 11 /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
.TP
A config section can also be matched by its pattern which supports regular expressions:
.RS
.nf
.eo
[usb device]
pattern=usb([0-9]*)
baudrate=115200
tty=/dev/ttyUSB%s
.ec
.fi
.RE
.TP
Making the following commands equivalent:
$ tio usb12
$ tio -b 115200 /dev/ttyUSB12
.SH "EXAMPLES"
.TP
Typical use is without options. For example:
$ tio /dev/ttyUSB0
.TP
Which corresponds to the commonly used options:
$ tio \-b 115200 \-d 8 \-f none \-s 1 \-p none /dev/ttyUSB0
.TP
It is recommended to connect serial tty devices by ID. For example:
$ tio /dev/serial/by\-id/usb\-FTDI_TTL232R-3V3_FTGQVXBL\-if00\-port0
.PP
Using serial devices by ID ensures that tio automatically reconnects to the
correct serial device if the device is disconnected and then reconnected.
.TP
To listen and redirect serial device I/O to network socket on port 4444 do:
$ tio -S inet:4444 /dev/ttyUSB0
.SH "WEBSITE"
.PP
Visit https://tio.github.io
.SH "AUTHOR"
.PP
Created by Martin Lund <martin.lund@keep\-it\-simple.com>.