There are already several serial terminal programs such as Putty and minicom, and in recent times, I’ve been using Bootterm myself. But that does not mean there isn’t room for more and Martin Lund has developed tio serial device I/O tool for Linux.
Martin found out many of the existing tools are very modem focused or a bit cumbersome to use, so he developed tio as the simpler alternative which puts less focus on classic terminal/modem features and more focus on the needs of embedded developers and hackers.
While it’s possible to build tio from source…
1 2 3 4 |
$ git clone https://github.com/tio/tio $ meson build $ meson compile -C build $ sudo meson install -C build |
it’s much easier to install as a snap (and you should get updates automatically):
1 |
$ snap install tio --classic |
Let’s see the options offered with the “help” parameter:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
tio --help Usage: /snap/tio/438/usr/bin/tio [<options>] <tty-device|config> Options: -b, --baudrate <bps> Baud rate (default: 115200) -d, --databits 5|6|7|8 Data bits (default: 8) -f, --flow hard|soft|none Flow control (default: none) -s, --stopbits 1|2 Stop bits (default: 1) -p, --parity odd|even|none Parity (default: none) -o, --output-delay <ms> Output delay (default: 0) -n, --no-autoconnect Disable automatic connect -e, --local-echo Enable local echo -t, --timestamp Enable line timestamp --timestamp-format <format> Set timestamp format (default: 24hour) -L, --list-devices List available serial devices -l, --log Enable log to file --log-file <filename> Set log filename --log-strip Strip control characters and escape sequences -m, --map <flags> Map special characters -c, --color 0..255|none|list Colorize tio text (default: 15) -S, --socket <socket> Redirect I/O to socket -x, --hex-mode Enable hexadecimal mode -v, --version Display version -h, --help Display help Options may be set via configuration file. In session, press ctrl-t q to quit. See the man page for more details. |
I’ve connected a USB to TTL board to check it out:
1 2 |
$ tio -L /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 |
It’s detected properly, but not exactly in the usual way since the board is attached to /dev/ttyUSB0:
1 2 3 4 5 6 7 8 9 10 |
[10490.292941] usb 1-1: new full-speed USB device number 4 using xhci_hcd [10490.458456] usb 1-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54 [10490.458466] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [10490.458470] usb 1-1: Product: USB2.0-Serial [10490.542269] usbcore: registered new interface driver usbserial_generic [10490.542284] usbserial: USB Serial support registered for generic [10490.544859] usbcore: registered new interface driver ch341 [10490.544919] usbserial: USB Serial support registered for ch341-uart [10490.544948] ch341 1-1:1.0: ch341-uart converter detected [10490.557605] usb 1-1: ch341-uart converter now attached to ttyUSB0 |
Anyway, I was still able to use it with Khadas VIM4 board after setting the baud rate to 921600:
1 2 3 4 5 6 7 8 9 10 |
$ tio /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 -b 921600 [11:59:32.534] tio v1.40 [11:59:32.534] Press ctrl-t q to quit [11:59:32.544] Connected ���T7:BL:055c20;ID:9056601109811D08;FEAT:30F:1FFF0000:B002F:1;POC:CF;RCY:0;OVD:0;DFU:0;SD:2002;eMMC:0;RD-0:0;CHK:0;SCS:0; Bl2_early_platform_setup: indicates bl2ex flow! OTP_LIC00 : 0f0300000000ff1f2f000b0000000000 OTP_LIC10 : 008207000001fc000c00001000000300 |
I could launch the program before booting the board to get the full log. It’s actually fairly similar to bootterm, including the options for timestamps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
$ tio /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 -b 921600 -t [14:09:55.213] tio v1.40 [14:09:55.213] Press ctrl-t q to quit [14:09:55.223] Connected [14:09:56.976] T7:BL:055c20;ID:9056601109811D08;FEAT:30F:1FFF0000:B002F:1;POC:CF;RCY:0;OVD:0;DFU:0;SD:2002;eMMC:0;RD-0:0;CHK:0;SCS:0; [14:09:57.533] Bl2_early_platform_setup: indicates bl2ex flow! [14:09:57.550] OTP_LIC00 : 0f0300000000ff1f2f000b0000000000 [14:09:57.550] OTP_LIC10 : 008207000001fc000c00001000000300 [14:09:57.551] OTP_LIC20 : ffffffbfffff0700ff80008003000003 [14:09:57.551] OTP_LIC30 : 00000002010000008f03000203000000 [14:09:57.552] TE: 380759 [14:09:57.552] BL2 Built : 09:58:05, Nov 19 2021. t7 griscure-review-sc2-bl2-10272020-2-102-g199647c - jenkins@walle02-sh [14:09:57.553] Board ID = 5 [14:09:57.553] Set sys clock to 24Mhz [14:09:57.554] syspll is 1512Mhz. Locked [14:09:57.554] sys1pll is 1608Mhz. Locked [14:09:57.554] Set sys clock to 167Mhz [14:09:57.555] gp0pll is 0Mhz. Locked [14:09:57.555] bl2_platform_setup [14:09:57.555] boot area list: [14:09:57.555] 1STBLOB 00000200 00040000 [14:09:57.556] BL2E 00040200 00013000 [14:09:57.556] BL2X 00053200 00011000 [14:09:57.556] DDRFIP 00064200 00040000 [14:09:57.556] DEVFIP 000a4200 00300000 [14:09:57.557] s_setup from rom:00010081 |
tio does however offer redirection of I/O to sockets for scripting or TTY sharing, hex mode, and changing the text color.
It’s also possible to change the default configuration via $XDG_CONFIG_HOME/tio/tiorc, $HOME/.config/tio/tiorc, or $HOME/.tiorc file.
You’ll find all details about tio serial device I/O tool on the project page on Github. As a side note, it’s not the first time we’ve written about Martin’s open-source tools, as we previously covered LXI Tools made for “LAN eXtensions for Instrumentation” compliant test instruments.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Interesting, thanks for sharing! I have not yet implemented the config file management for macros and mapping of serial ports to configs into bootterm, so I think tio could possibly be a nice complement for certain use cases. It’s always great to have a variety of tools at hand.
Honestly, if it just works and is able to understand color codes etc. that would be a huge win. There are certain scenarios other implementations struggle with.
Usually you have only two choices, either you do not interfer with what you receive and it works fine, or you start to interfer then you need to completely manage the terminal and deal with everything otherwise the tiniest miss causes noticeable glitches such as copy-paste breaking on end of line and such things. That’s also when you notice you can’t scroll up typically (e.g. minicom). bootterm chooses the first approach and keeps colors and scrolling history working fine; that’s also why you can’t have pop-up menus. Tio seems to have chosen the same approach. Quite frankly, I think anyone… Read more »