]> git.sur5r.net Git - tio/commitdiff
New upstream version 2.3 upstream/2.3
authorJakob Haufe <sur5r@debian.org>
Fri, 4 Nov 2022 21:11:28 +0000 (22:11 +0100)
committerJakob Haufe <sur5r@debian.org>
Fri, 4 Nov 2022 21:11:28 +0000 (22:11 +0100)
NEWS
README.md
TODO
example/tiorc
man/tio.1.in
meson.build
src/bash-completion/tio.in
src/configfile.c
src/options.c
src/tty.c

diff --git a/NEWS b/NEWS
index 1a1cc4dbb151e0eaf923a66ad27e15e35670a80c..a5fff49c432cd9fc34d691eb2a2747b893830a3e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,21 @@
 
-=== 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
 
 
 
index 1c87aa0c75e133c161b9e9dd37f1963848611892..0033c645bfbdd6cb9684f7dc385ba2b312fc5096 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
 
 [![](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
 
@@ -69,7 +69,7 @@ The command-line interface is straightforward as reflected in the output from
 ```
  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)
@@ -127,7 +127,7 @@ Which corresponds to the commonly used default options:
 $ 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
 ```
@@ -139,7 +139,7 @@ List available serial devices by ID:
 $ 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:
 ```
@@ -203,7 +203,7 @@ following locations in the order listed:
 
 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:
 
@@ -216,7 +216,7 @@ stopbits = 1
 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
@@ -226,7 +226,7 @@ color = 12
 
 [usb devices]
 pattern = usb([0-9]*)
-tty = /dev/ttyUSB%s
+device = /dev/ttyUSB%s
 color = 13
 ```
 
diff --git a/TODO b/TODO
index 14d80254653c4786cb4901dcbf17890980672493..ce251732ca8c00583b814b5a556c6f6da661dc0c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,33 @@
 
+ * 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
index 525a982eb60260a7c433e5b4046c5022f96e037d..78a197b8048c7f9708a250ffe5c03be47afc2c6d 100644 (file)
@@ -28,32 +28,32 @@ alert = none
 
 [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
index 936ab5c85e02843c09ea279e23f9b1c232bac223..01349d835578e4d6b7293ca8251da68b1da816bd 100644 (file)
@@ -340,7 +340,7 @@ activated from the command-line when starting tio.
 
 .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.
@@ -354,8 +354,8 @@ The following configuration file options are available:
 .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"
@@ -433,7 +433,7 @@ Named sub-configurations can be added via labels:
 .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
@@ -458,7 +458,7 @@ A sub-configuration can also be activated by its pattern which supports regular
 .eo
 [usb device]
 pattern = usb([0-9]*)
-tty = /dev/ttyUSB%s
+device = /dev/ttyUSB%s
 baudrate = 115200
 .ec
 .fi
@@ -489,7 +489,7 @@ Which corresponds to the commonly used default 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:
+It is recommended to connect serial TTY devices by ID:
 
 $ tio /dev/serial/by\-id/usb\-FTDI_TTL232R-3V3_FTGQVXBL\-if00\-port0
 .PP
@@ -528,13 +528,13 @@ expect -i $uart "prompt> "
 .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
 
index 9a91e851a53f24fd1cb1d9b9b7df1f8b4323750b..bf265e2e0582b3e25e4840600917c1d26c420394 100644 (file)
@@ -1,5 +1,5 @@
 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' ]
index 82cb649964f54863791cfca21593ca0eaad797ed..9602c4fb93a54a599cc286c4beca8aba6128c950 100644 (file)
@@ -35,6 +35,7 @@ _tio()
              --rs-485 \
              --rs-485-config \
              --alert \
+             --mute \
           -v --version \
           -h --help"
 
@@ -141,6 +142,10 @@ _tio()
             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
index e749e4b49f9453a362d2f50ea790f5bc0545e662..8e29a26d2bfcb2b0c3b20df1be9954d7e361b4c1 100644 (file)
@@ -112,7 +112,7 @@ static int data_handler(void *user, const char *section, const char *name,
     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;
@@ -302,6 +302,17 @@ static int data_handler(void *user, const char *section, const char *name,
         {
             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;
@@ -493,7 +504,7 @@ void config_file_print(void)
 {
     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);
index 7b61fd810adabc8bf98ca0c6ac111421d38b4105..cac622263ed00cfa41afea868ffaa6fa59aea570 100644 (file)
@@ -51,6 +51,7 @@ enum opt_t
     OPT_RS485_CONFIG,
     OPT_ALERT,
     OPT_COMPLETE_SUB_CONFIGS,
+    OPT_MUTE,
 };
 
 /* Default options */
@@ -99,7 +100,7 @@ void print_help(char *argv[])
 
     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");
@@ -127,6 +128,7 @@ void print_help(char *argv[])
     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");
@@ -193,7 +195,7 @@ void line_pulse_duration_option_parse(const char *arg)
 
 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);
@@ -258,6 +260,7 @@ void options_parse(int argc, char *argv[])
             {"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},
@@ -413,6 +416,10 @@ void options_parse(int argc, char *argv[])
                 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);
index 75c724230b34de2f0fad913bfbb2354892292af7..8c7bfa7684ceffc3e49797d52cf3285e03eb22f6 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -473,8 +473,8 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
 
             case KEY_C:
                 tio_printf("Configuration:");
-                config_file_print();
                 options_print();
+                config_file_print();
                 if (option.rs485)
                 {
                     rs485_print_config();