Skip to content

Commit

Permalink
2.7: Xmodem-CRC support.
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Apr 10, 2024
1 parent 98cd2fb commit afa6abd
Show file tree
Hide file tree
Showing 27 changed files with 1,967 additions and 273 deletions.
9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,14 @@ Ralph Siemsen <[email protected]>
Victor Oliveira <[email protected]>
Attila Veghelyi <[email protected]>
Vyacheslav Patkov <[email protected]>
Bill Hass <[email protected]>
Peter van Dijk <[email protected]>
Braden Young <[email protected]>
Wes Koerber <[email protected]>
HiFiPhile <[email protected]>
Paul Ruizendaal <[email protected]>
Fredrik Svedberg <[email protected]>
Sebastian <[email protected]>
Mingjie Shen <[email protected]>

Thanks to everyone who has contributed to this project.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ VERSION=2.5
BAUDRATES=0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400 460800 500000 576000 921600 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 # not found: 7200 14400 28800 76800

CC=cc
CFLAGS=-Wall -std=gnu99 -pthread -Isrc
LDFLAGS= -linih -s
CFLAGS=-Wall -std=gnu99 -pthread -Isrc `pkg-config --cflags lua`
LDFLAGS= -linih -s `pkg-config --libs lua`
RM = rm -f
SRCS = \
src/alert.c \
Expand All @@ -15,11 +15,13 @@ SRCS = \
src/options.c \
src/print.c \
src/rs485.c \
src/script.c \
src/setspeed.c \
src/signals.c \
src/socket.c \
src/timestamp.c \
src/tty.c \
src/xymodem.c \
src/main.c

all: $(TARGET)
Expand Down
91 changes: 86 additions & 5 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,86 @@

=== tio v2.5 ===
=== tio v2.7 ===



Changes since tio v2.6:

Paul Ruizendaal:

* Add xmodem and ymodem file send support

HiFiPhile:

* tty_stdin_input_thread(): write to pipe only if byte_count > 0.

* Ignore EINTR error.

* CYGWIN: Add support for "COM*" naming.

Wes Koerber:

* chore: reorder log-strip and log-append

reorder to maintain consistency with documentation

* chore: update readme, bash completion, man page

* fix: support --log-append in cli options



Changes since tio v2.5:

* Remove warning when using pattern option

* Add --log-append option

Add --log-append option which makes tio append to any existing log file.

This also changes the default behaviour of tio from appending to
overwriting any existing log file. Now you have to use this new option
to make tio append.

* Update man page

* Update README

* Fix line termination for response wait feature

The response wait feature waited for a line response, a string
terminated with either CR or NL. However, some devices may send a CR and
then their line content and then NL. This means tio will quit before
receiving and printing the line response. To solve this we simply ignore
the CR character and only consider lines terminated with a NL character.

This should work for all devices as lines are AFAIK always terminated
with either CRNL or a NL.

* Update tty device listing configuration

Cleanup and add FreeBSD tty device listing support.

Braden Young:

* Move map variables to tty to keep them all in one spot

* Configure socket mapping flags from tty parsing logic. Remove duplicate parsing logic in socket

* Support input mapping modes for sockets

Josh Soref:

* Various spelling fixes

Peter van Dijk:

* avoid "warning: unused parameter" on setspeed stub

* use right /dev/ path on Haiku

Bill Hass:

* Update README with details on snap confinement



Expand Down Expand Up @@ -524,7 +605,7 @@ Changes since tio v1.39:
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
Non interactive 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.

Expand Down Expand Up @@ -653,7 +734,7 @@ Changes since tio v1.38:
inherently inconsistent with how you define required arguments.

To avoid confusion we decide to avoid this inconsistency by replacing
optional options with additional options with required argmuments.
optional options with additional options with required arguments.

* Replace '1' with 'enable' in config files

Expand Down Expand Up @@ -1018,10 +1099,10 @@ Alban Bedel:
* Fix out of tree builds

Out of tree builds are currently broken because $(top_srcdir)src/include
is not in the search path. In tree builds are working because autconf add
is not in the search path. In tree builds are working because autoconf adds
$(top_builddir)/src/include to the search path for the generated config.h.
As $(top_builddir) and $(top_srcdir) are identical during in tree builds
the search path still end up beeing somehow correct.
the search path still end up being somehow correct.

To fix this add -I$(srcdir)/include to the CPPFLAGS in Makefile.am.

Expand Down
157 changes: 94 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
![GitHub all releases](https://img.shields.io/github/downloads/FS-make-simple/tio/total)
![GitHub](https://img.shields.io/github/license/FS-make-simple/tio)

[![tio](images/tio-icon.png)]()

# tio - a simple serial device I/O tool

[![](https://img.shields.io/circleci/build/gh/tio/tio?token=da7e7fd0d0ee99b9f986f8877dcdbe28f73d9e06)](https://circleci.com/gh/tio/tio/tree/master)
[![](https://img.shields.io/circleci/build/github/tio/tio)](https://circleci.com/github/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/repology/repositories/tio)](https://repology.org/project/tio/versions)
[![](https://img.shields.io/tokei/lines/github/tio/tio)](https://github.com/tio/tio)
<!-- [![](https://img.shields.io/tokei/lines/github/tio/tio)](https://github.com/tio/tio) -->

## 1. Introduction

Expand All @@ -34,18 +36,19 @@ To make a simpler serial device tool for talking with serial TTY devices with
less focus on classic terminal/modem features and more focus on the needs of
embedded developers and hackers.

tio was originally created to replace
tio was originally created as an alternative to
[screen](https://www.gnu.org/software/screen) for connecting to serial devices
when used in combination with [tmux](https://tmux.github.io).

## 2. Features

* Easily connect to serial TTY devices
* Automatic connect and reconnect
* Sensible defaults
* Sensible defaults (115200 8n1)
* Support for non-standard baud rates
* Support for RS-485 mode
* Support for mark and space parity
* X-modem (1K) and Y-modem file upload
* Support for RS-485 mode
* List available serial devices by ID
* Show RX/TX statistics
* Toggle serial lines
Expand All @@ -55,9 +58,8 @@ when used in combination with [tmux](https://tmux.github.io).
* Line timestamps
* Support for delayed output per character
* Support for delayed output per line
* Hexadecimal mode
* Log to file
* Autogeneration of log filename
* Switchable independent input and output mode (normal vs hex)
* Log to file with automatic or manual naming of log file
* Configuration file support
* Activate sub-configurations by name or pattern
* Redirect I/O to UNIX socket or IPv4/v6 network socket for scripting or TTY sharing
Expand All @@ -67,7 +69,11 @@ when used in combination with [tmux](https://tmux.github.io).
* Configurable text color
* Visual or audible alert on connect/disconnect
* Remapping of prefix key
* Support NO_COLOR env variable as per no-color.org
* Man page documentation
* Lua scripting support
* Manipulate port control lines at connect/reconnect (useful for microcontroller reset/boot etc.)
* Automate interaction with tty device (TBD)
* Plays nicely with [tmux](https://tmux.github.io)

## 3. Usage
Expand All @@ -80,43 +86,49 @@ For more usage details please see the man page documentation
The command-line interface is straightforward as reflected in the output from
'tio --help':
```
Usage: tio [<options>] <tty-device|sub-config>
Connect to TTY device directly or via sub-configuration.
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|mark|space Parity (default: none)
-o, --output-delay <ms> Output character delay (default: 0)
-O, --output-line-delay <ms> Output line delay (default: 0)
--line-pulse-duration <duration> Set line pulse duration
-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 characters
-c, --color 0..255|bold|none|list Colorize tio text (default: bold)
-S, --socket <socket> Redirect I/O to socket
-x, --hexadecimal Enable hexadecimal mode
-r, --response-wait Wait for line response then quit
--response-timeout <ms> Response timeout (default: 100)
--rs-485 Enable RS-485 mode
--rs-485-config <config> Set RS-485 configuration
--alert bell|blink|none Alert on connect/disconnect (default: none)
-v, --version Display version
-h, --help Display help
Options and sub-configurations may be set via configuration file.
See the man page for more details.
Usage: tio [<options>] <tty-device|sub-config>
Connect to TTY device directly or via sub-configuration.
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|mark|space Parity (default: none)
-o, --output-delay <ms> Output character delay (default: 0)
-O, --output-line-delay <ms> Output line delay (default: 0)
--line-pulse-duration <duration> Set line pulse duration
-n, --no-autoconnect Disable automatic connect
-e, --local-echo Enable local echo
--input-mode normal|hex Select input mode (default: normal)
--output-mode normal|hex Select output mode (default: normal)
-t, --timestamp Enable line timestamp
--timestamp-format <format> Set timestamp format (default: 24hour)
-L, --list-devices List available serial devices by ID
-l, --log Enable log to file
--log-file <filename> Set log filename
--log-directory <path> Set log directory path for automatic named logs
--log-append Append to log file
--log-strip Strip control characters and escape sequences
-m, --map <flags> Map characters
-c, --color 0..255|bold|none|list Colorize tio text (default: bold)
-S, --socket <socket> Redirect I/O to socket
-r, --response-wait Wait for line response then quit
--response-timeout <ms> Response timeout (default: 100)
--rs-485 Enable RS-485 mode
--rs-485-config <config> Set RS-485 configuration
--alert bell|blink|none Alert on connect/disconnect (default: none)
--mute Mute tio
--script <string> Run script from string
--script-file <filename> Run script from file
--script-run once|always|never Run script on connect (default: always)
-v, --version Display version
-h, --help Display help
Options and sub-configurations may be set via configuration file.
See the man page for more details.
```

By default tio automatically connects to the provided TTY device if present.
Expand Down Expand Up @@ -186,23 +198,30 @@ Various in session key commands are supported. When tio is started, press
ctrl-t ? to list the available key commands.

```
[20:19:12.040] Key commands:
[20:19:12.040] ctrl-t ? List available key commands
[20:19:12.040] ctrl-t b Send break
[20:19:12.040] ctrl-t c Show configuration
[20:19:12.040] ctrl-t e Toggle local echo mode
[20:19:12.040] ctrl-t f Toggle log to file
[20:19:12.040] ctrl-t g Toggle serial port line
[20:19:12.040] ctrl-t h Toggle hexadecimal mode
[20:19:12.040] ctrl-t l Clear screen
[20:19:12.040] ctrl-t L Show line states
[20:19:12.040] ctrl-t p Pulse serial port line
[20:19:12.040] ctrl-t q Quit
[20:19:12.041] ctrl-t s Show statistics
[20:19:12.041] ctrl-t t Toggle line timestamp mode
[20:19:12.041] ctrl-t U Toggle conversion to uppercase
[20:19:12.041] ctrl-t v Show version
[20:19:12.041] ctrl-t ctrl-t Send ctrl-t character
[15:02:53.269] Key commands:
[15:02:53.269] ctrl-t ? List available key commands
[15:02:53.269] ctrl-t b Send break
[15:02:53.269] ctrl-t c Show configuration
[15:02:53.269] ctrl-t e Toggle local echo mode
[15:02:53.269] ctrl-t f Toggle log to file
[15:02:53.269] ctrl-t F Flush data I/O buffers
[15:02:53.269] ctrl-t g Toggle serial port line
[15:02:53.269] ctrl-t i Toggle input mode
[15:02:53.269] ctrl-t l Clear screen
[15:02:53.269] ctrl-t L Show line states
[15:02:53.269] ctrl-t m Toggle MSB to LSB bit order
[15:02:53.269] ctrl-t o Toggle output mode
[15:02:53.269] ctrl-t p Pulse serial port line
[15:02:53.269] ctrl-t q Quit
[15:02:53.269] ctrl-t r Run script
[15:02:53.269] ctrl-t s Show statistics
[15:02:53.269] ctrl-t t Toggle line timestamp mode
[15:02:53.269] ctrl-t U Toggle conversion to uppercase on output
[15:02:53.269] ctrl-t v Show version
[15:02:53.269] ctrl-t x Send file via Xmodem-1K
[15:02:53.269] ctrl-t X Send file via Xmodem-CRC
[15:02:53.269] ctrl-t y Send file via Ymodem
[15:02:53.269] ctrl-t ctrl-t Send ctrl-t character
```

If needed, the prefix key (ctrl-t) can be remapped via configuration file.
Expand Down Expand Up @@ -269,9 +288,12 @@ reach out to its package maintainers team.

Install latest stable version:
```
$ snap install tio
$ snap install tio --classic
```

Note: Classic confinement is currently required due to limitations of the snapcraft framework.
See [Issue #187](https://github.com/tio/tio/issues/187) for discussion.

### 4.3 Installation using brew (MacOS, Linux)

If you have [brew](http://brew.sh) installed:
Expand Down Expand Up @@ -299,6 +321,15 @@ See meson\_options.txt for tio specific build options.

Note: The meson install steps may differ depending on your specific system.

### 4.6 Known issues

Getting permission access errors trying to open your serial device?

Add your user to the group which allows serial device access. For example, to add your user to the 'dialout' group do:
```
$ sudo usermod -a -G dialout <username>
```


## 5. Contributing

Expand Down
Loading

0 comments on commit afa6abd

Please sign in to comment.