1tio(1) User Commands tio(1)
2
3
4
6 tio - a simple serial device I/O tool
7
8
10 tio [<options>] <tty-device|sub-config>
11
12
14 tio is a simple serial device tool which features a straightforward
15 command-line and configuration file interface to easily connect to se‐
16 rial TTY devices for basic I/O operations.
17
18
20 -b, --baudrate <bps>
21
22 Set baud rate [bps] (default: 115200).
23
24 -d, --databits 5|6|7|8
25
26 Set data bits (default: 8).
27
28 -f, --flow hard|soft|none
29
30 Set flow control (default: none).
31
32 -s, --stopbits 1|2
33
34 Set stop bits (default: 1).
35
36 -p, --parity odd|even|none
37
38 Set parity (default: none).
39
40 -o, --output-delay <ms>
41
42 Set output delay [ms] inserted between each sent character (de‐
43 fault: 0).
44
45
46 --dtr-pulse-duration <ms>
47
48 Set the duration [ms] of the DTR pulse (default: 100).
49
50
51 -n, --no-autoconnect
52
53 Disable automatic connect.
54
55 By default tio automatically connects to the provided device if
56 present. If the device is not present, it will wait for it to
57 appear and then connect. If the connection is lost (eg. device
58 disconnects), it will wait for the device to reappear and then
59 reconnect.
60
61 However, if the --no-autoconnect option is provided, tio will
62 exit if the device is not present or an established connection
63 is lost.
64
65
66 -e, --local-echo
67
68 Enable local echo.
69
70
71 -t, --timestamp
72
73 Enable line timestamp.
74
75
76 --timestamp-format <format>
77
78 Set timestamp format to any of the following timestamp formats:
79
80
81
82 24hour 24-hour format ("hh:mm:ss.sss")
83
84 24hour-start 24-hour format relative to start time
85
86 24hour-delta 24-hour format relative to previous timestamp
87
88 iso8601 ISO8601 format ("YYYY-MM-DDThh:mm:ss.sss")
89
90 Default format is 24hour
91
92
93 -L, --list-devices
94
95 List available serial devices.
96
97
98 -l, --log
99
100 Enable log to file. If no filename is provided the filename will
101 be automatically generated.
102
103
104 --log-file <filename>
105
106 Set log filename.
107
108
109 --log-strip
110
111 Strip control characters and escape sequences from log.
112
113
114 -m, --map <flags>
115
116 Map (replace, translate) special characters on input or output.
117 The following mapping flags are supported:
118
119
120 ICRNL Map CR to NL on input (unless IGNCR is set).
121
122 IGNCR Ignore CR on input.
123
124 INLCR Map NL to CR on input.
125
126 INLCRNL Map NL to CR-NL on input.
127
128 OCRNL Map CR to NL on output.
129
130 ODELBS Map DEL to BS on output.
131
132 ONLCRNL Map NL to CR-NL on output.
133
134 If defining more than one flag, the flags must be comma sepa‐
135 rated.
136
137
138 -x, --hexadecimal
139
140 Enable hexadecimal mode.
141
142
143 -c, --color 0..255|none|list
144
145 Colorize tio text using ANSI color code value ranging from 0 to
146 255 or use "none" for no color.
147
148 Use "list" to print a list of available ANSI color codes.
149
150 Default value is 15.
151
152
153 -S, --socket <socket>
154
155 Redirect I/O to socket. Any input from clients connected to the
156 socket is sent on the serial port as if entered at the terminal
157 where tio is running (except that ctrl-t sequences are not rec‐
158 ognized), and any input from the serial port is multiplexed to
159 the terminal and all connected clients.
160
161 Sockets remain open while the serial port is disconnected, and
162 writes will block.
163
164 Various socket types are supported using the following prefixes
165 in the socket field:
166
167
168
169 unix:<filename> Unix Domain Socket (file)
170
171 inet:<port> Internet Socket (network)
172
173 inet6:<port> Internet IPv6 Socket (network)
174
175 If port is 0 or no port is provided default port 3333 is used.
176
177 At present there is a hardcoded limit of 16 clients connected at
178 one time.
179
180
181 -v, --version
182
183 Display program version.
184
185 -h, --help
186
187 Display help.
188
190 In session, the following key sequences are intercepted as tio com‐
191 mands:
192
193 ctrl-t ? List available key commands
194
195 ctrl-t b Send serial break (triggers SysRq on Linux, etc.)
196
197 ctrl-t c Show configuration (baudrate, databits, etc.)
198
199 ctrl-t e Toggle local echo mode
200
201 ctrl-t h Toggle hexadecimal mode
202
203 ctrl-t l Clear screen
204
205 ctrl-t q Quit
206
207 ctrl-t s Show TX/RX statistics
208
209 ctrl-t t Send ctrl-t key code
210
211 ctrl-t L Show line states (DTR, RTS, CTS, DSR, DCD, RI)
212
213 ctrl-t d Toggle DTR
214
215 ctrl-t D Pulse DTR
216
217 ctrl-t r Toggle RTS
218
219 ctrl-t v Show version
220
221
223 In hexadecimal mode each incoming byte is printed out as a hexadecimal
224 value.
225
226 Bytes can be sent in this mode by typing the two-character hexadecimal
227 representation of the value, e.g.: to send 0xA you must type 0a or 0A.
228
229
231 Options can be set via configuration file using the INI format. tio
232 uses the configuration file first found in the following locations in
233 the order listed:
234
235 $XDG_CONFIG_HOME/tio/tiorc
236
237 $HOME/.config/tio/tiorc
238
239 $HOME/.tiorc
240
241
242 Labels can be used to group settings into named sub-configurations
243 which can be activated from the command-line when starting tio.
244
245
246
247 tio will try to match the user input to a sub-configuration by name or
248 by pattern to get the tty and other options.
249
250
251 Options without any label change the default options.
252
253
254 Any options set via command-line will override options set in the con‐
255 figuration file.
256
257
258 The following configuration file options are available:
259
260
261
262 pattern Pattern matching user input. This pattern can be an
263 extended regular expression with a single group.
264
265 tty tty device to open. If it contains a "%s" it is
266 substituted with the first group match.
267
268 baudrate Set baud rate
269
270 databits Set data bits
271
272 flow Set flow control
273
274 stopbits Set stop bits
275
276 parity Set parity
277
278 output-delay Set output delay
279
280 dtr-pulse-duration Set DTR pulse duration
281
282 no-autoconnect Disable automatic connect
283
284 log Enable log to file
285
286 log-file Set log filename
287
288 log-strip Enable strip of control and escape sequences from
289 log
290
291 local-echo Enable local echo
292
293 timestamp Enable line timestamp
294
295 timestamp-format Set timestamp format
296
297 map Map special characters on input or output
298
299 color Colorize tio text using ANSI color code ranging
300 from 0 to 255
301
302 hexadecimal Enable hexadecimal mode
303
304 socket Set socket to redirect I/O to
305
306
308 To change the default configuration simply set options like so:
309
310 # Defaults
311 baudrate = 9600
312 databits = 8
313 parity = none
314 stopbits = 1
315 color = 10
316 dtr-pulse-duration = 50
317
318
319 Named sub-configurations can be added via labels:
320
321 [rpi3]
322 tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
323 baudrate = 115200
324 color = 11
325
326
327 Activate the sub-configuration by name:
328
329 $ tio rpi3
330
331
332 Which is equivalent to:
333
334 $ tio -b 115200 -c 11 /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FT‐
335 GQVXBL-if00-port0
336
337
338 A sub-configuration can also be activated by its pattern which supports
339 regular expressions:
340
341 [usb device]
342 pattern = usb([0-9]*)
343 tty = /dev/ttyUSB%s
344 baudrate = 115200
345
346
347 Activate the sub-configuration by pattern match:
348
349 $ tio usb12
350
351
352 Which is equivalent to:
353
354 $ tio -b 115200 /dev/ttyUSB12
355
356
357 It is also possible to combine use of sub-configuration and command-
358 line options. For example:
359
360 $ tio -l -t usb12
361
362
364 Typical use is without options:
365
366 $ tio /dev/ttyUSB0
367
368 Which corresponds to the commonly used default options:
369
370 $ tio -b 115200 -d 8 -f none -s 1 -p none /dev/ttyUSB0
371
372 It is recommended to connect serial tty devices by ID:
373
374 $ tio /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
375
376 Using serial devices by ID ensures that tio automatically reconnects to
377 the correct serial device if it is disconnected and then reconnected.
378
379 Redirect serial device I/O to Unix file socket for scripting:
380
381 $ tio -S unix:/tmp/tmux-socket0 /dev/ttyUSB0
382
383
384 Then, to issue a command via the file socket simply do:
385
386 $ echo "ls -la" | nc -UN /tmp/tmux-socket0 > /dev/null
387
388
389 Or use the expect command to script an interaction:
390
391 #!/usr/bin/expect -f
392
393 set timeout -1
394 log_user 0
395
396 spawn nc -UN /tmp/tio-socket0
397 set uart $spawn_id
398
399 send -i $uart "date\n"
400 expect -i $uart "prompt> "
401 send -i $uart "ls -la\n"
402 expect -i $uart "prompt> "
403
404
405 Redirect device I/O to network file socket for remote tty sharing:
406
407 $ tio --socket inet:4444 /dev/ttyUSB0
408
409
410
411 Then, use netcat to connect to the shared tty session over network (as‐
412 suming tio is hosted on IP 10.0.0.42):
413
414 $ nc -N 10.0.0.42 4444
415
416
417 Pipe data from file to the serial device:
418
419 $ cat data.bin | tio /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FT‐
420 GQVXBL-if00-port0
421
422
424 Visit https://tio.github.io
425
426
428 Created by Martin Lund <martin.lund@keep-it-simple.com>.
429
430
431
432tio 1.43 2022-07-09 tio(1)