-=== tio v2.2 ===
+=== tio v2.3 ===
+
+
+
+Changes since tio v2.2:
+
+ * Add mute feature
+
+ This will make tio go fully silent and not print anything.
+
+ * Rename config variable 'tty' to 'device'
+
+ * Deprecate tty config keyword but keep it around for now
+
+ * Update show config
+
+ * Update example tiorc
[![](https://img.shields.io/circleci/build/gh/tio/tio?token=da7e7fd0d0ee99b9f986f8877dcdbe28f73d9e06)](https://circleci.com/gh/tio/tio/tree/master)
[![](https://img.shields.io/github/v/release/tio/tio?sort=semver)](https://github.com/tio/tio/releases)
-[![](https://img.shields.io/tokei/lines/github/tio/tio)](https://github.com/tio/tio)
[![](https://img.shields.io/repology/repositories/tio)](https://repology.org/project/tio/versions)
+[![](https://img.shields.io/tokei/lines/github/tio/tio)](https://github.com/tio/tio)
## 1. Introduction
```
Usage: tio [<options>] <tty-device|sub-config>
- Connect to tty device directly or via sub-configuration.
+ Connect to TTY device directly or via sub-configuration.
Options:
-b, --baudrate <bps> Baud rate (default: 115200)
$ tio -b 115200 -d 8 -f none -s 1 -p none /dev/ttyUSB0
```
-It is recommended to connect serial tty devices by ID:
+It is recommended to connect serial TTY devices by ID:
```
$ tio /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
```
$ tio --list-devices
```
Note: One can also use tio shell completion on /dev which will automatically
-list all available serial tty devices.
+list all available serial TTY devices.
Log to file with autogenerated filename:
```
The configuration file supports sub-configurations using named sections which can
be activated via the command-line by name or pattern. A sub-configuration
-specifies which tty to connect to and other options.
+specifies which TTY device to connect to and other options.
Example configuration file:
color = 10
[rpi3]
-tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
+device = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
baudrate = 115200
no-autoconnect = enable
log = enable
[usb devices]
pattern = usb([0-9]*)
-tty = /dev/ttyUSB%s
+device = /dev/ttyUSB%s
color = 13
```
+ * Allow tio to connect to socket
+
+ After some more consideration I think it makes sense to support connecting to a
+ socket as that will make tio be able to both serve a serial port via a socket
+ and connect to it - it will be an end to end solution. In short we will be able
+ to do the following:
+
+ Host serial port on socket (existing feature):
+ $ tio --socket unix:/tmp/tio-socket-0 /dev/ttyUSB0
+
+ Connect to same socket (new feature):
+ $ tio unix:/tmp/tio-socket-0
+
+ Besides a bit of refactoring the following required changes spring to mind:
+
+ * Socket mode and type of socket should be activated via device name prefix. For example:
+ * UNIX socket: tio unix:<filename>
+ * TCPv4 socket: tio inet:<ip>:<port>
+ * TCPv6 socket: tio inet6:<ip>:<port>
+ * If no port number defined default to 3333
+ * Mapping flags INLCR, IGNCR, ICRNL needs implementation for socket mode
+ * Error messages should just say "device" instead of "tty device" etc.
+ * Remove other tty'isms (tty_write() should be device_write() etc.)
+ * In session key commands that do not work in socket mode should either not be listed or print an error messages if used.
+ * All non-tty features should continue work (auto-connect etc.)
+ * Shell completion script update
+ * Man page update
+
+
* Split I/O feature
Allow to split input and output so that it is possible to manage these
[rpi3]
baudrate = 115200
-tty = /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A6009HU3-if00-port0
+device = /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A6009HU3-if00-port0
socket = unix:/tmp/tio-socket-0
color = 9
[am64-evm]
baudrate = 115200
-tty = /dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_01093176-if01-port0
+device = /dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_01093176-if01-port0
line-pulse-duration = DTR=200,RTS=300,RI=50
alert = bell
color = 10
[tincan]
baudrate = 9600
-tty = /dev/serial/by-id/usb-TinCanTools_Flyswatter2_FS20000-if00-port0
+device = /dev/serial/by-id/usb-TinCanTools_Flyswatter2_FS20000-if00-port0
log = enable
log-file = tincan.log
log-strip = enable
color = 11
-[usb devices]
+[usb]
pattern = usb([0-9]*)
-tty = /dev/ttyUSB%s
+device = /dev/ttyUSB%s
color = 12
[rs-485-device]
-tty = /dev/ttyUSB0
+device = /dev/ttyUSB0
rs-485 = enable
rs-485-config = RTS_ON_SEND=1,RTS_AFTER_SEND=1,RTS_DELAY_BEFORE_SEND=60,RTS_DELAY_AFTER_SEND=80,RX_DURING_TX
color = 13
.PP
\fBtio\fR will try to match the user input to a sub-configuration by name or by
-pattern to get the tty and other options.
+pattern to get the TTY device and other options.
.PP
Options without any label change the default options.
.TP 25n
.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 it contains a "%s" it is substituted with the first group match.
+.IP "\fBdevice"
+TTY device to open. If it contains a "%s" it is substituted with the first group match.
.IP "\fBbaudrate"
Set baud rate
.IP "\fBdatabits"
.nf
.eo
[rpi3]
-tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
+device = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
baudrate = 115200
color = 11
.ec
.eo
[usb device]
pattern = usb([0-9]*)
-tty = /dev/ttyUSB%s
+device = /dev/ttyUSB%s
baudrate = 115200
.ec
.fi
$ tio \-b 115200 \-d 8 \-f none \-s 1 \-p none /dev/ttyUSB0
.TP
-It is recommended to connect serial tty devices by ID:
+It is recommended to connect serial TTY devices by ID:
$ tio /dev/serial/by\-id/usb\-FTDI_TTL232R-3V3_FTGQVXBL\-if00\-port0
.PP
.RE
.TP
-Redirect device I/O to network file socket for remote tty sharing:
+Redirect device I/O to network file socket for remote TTY sharing:
$ tio --socket inet:4444 /dev/ttyUSB0
.TP
-Then, use netcat to connect to the shared tty session over network (assuming tio is hosted on IP 10.0.0.42):
+Then, use netcat to connect to the shared TTY session over network (assuming tio is hosted on IP 10.0.0.42):
$ nc -N 10.0.0.42 4444
project('tio', 'c',
- version : '2.2',
+ version : '2.3',
license : [ 'GPL-2'],
meson_version : '>= 0.53.2',
default_options : [ 'warning_level=2', 'buildtype=release', 'c_std=gnu99' ]
--rs-485 \
--rs-485-config \
--alert \
+ --mute \
-v --version \
-h --help"
COMPREPLY=( $(compgen -W "none bell blink" -- ${cur}) )
return 0
;;
+ --mute)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
-v | --version)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
if (!strcmp(section, c.section_name))
{
// Set configuration parameter if found
- if (!strcmp(name, "tty"))
+ if (!strcmp(name, "device") || !strcmp(name, "tty"))
{
asprintf(&c.tty, value, c.match);
option.tty_device = c.tty;
{
option.alert = alert_option_parse(value);
}
+ else if (!strcmp(name, "mute"))
+ {
+ if (!strcmp(value, "enable"))
+ {
+ option.mute = true;
+ }
+ else if (!strcmp(value, "disable"))
+ {
+ option.mute = false;
+ }
+ }
}
return 0;
{
if (c.path != NULL)
{
- tio_printf(" Path: %s", c.path);
+ tio_printf(" Active configuration file: %s", c.path);
if (c.section_name != NULL)
{
tio_printf(" Active sub-configuration: %s", c.section_name);
OPT_RS485_CONFIG,
OPT_ALERT,
OPT_COMPLETE_SUB_CONFIGS,
+ OPT_MUTE,
};
/* Default options */
printf("Usage: tio [<options>] <tty-device|sub-config>\n");
printf("\n");
- printf("Connect to tty device directly or via sub-configuration.\n");
+ printf("Connect to TTY device directly or via sub-configuration.\n");
printf("\n");
printf("Options:\n");
printf(" -b, --baudrate <bps> Baud rate (default: 115200)\n");
printf(" --rs-485 Enable RS-485 mode\n");
printf(" --rs-485-config <config> Set RS-485 configuration\n");
printf(" --alert bell|blink|none Alert on connect/disconnect (default: none)\n");
+ printf(" --mute Mute tio\n");
printf(" -v, --version Display version\n");
printf(" -h, --help Display help\n");
printf("\n");
void options_print()
{
- tio_printf(" TTY device: %s", option.tty_device);
+ tio_printf(" Device: %s", option.tty_device);
tio_printf(" Baudrate: %u", option.baudrate);
tio_printf(" Databits: %d", option.databits);
tio_printf(" Flow: %s", option.flow);
{"rs-485", no_argument, 0, OPT_RS485 },
{"rs-485-config", required_argument, 0, OPT_RS485_CONFIG },
{"alert", required_argument, 0, OPT_ALERT },
+ {"mute", no_argument, 0, OPT_MUTE },
{"version", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
{"complete-sub-configs", no_argument, 0, OPT_COMPLETE_SUB_CONFIGS},
option.alert = alert_option_parse(optarg);
break;
+ case OPT_MUTE:
+ option.mute = true;
+ break;
+
case 'v':
printf("tio v%s\n", VERSION);
exit(EXIT_SUCCESS);
case KEY_C:
tio_printf("Configuration:");
- config_file_print();
options_print();
+ config_file_print();
if (option.rs485)
{
rs485_print_config();