Commit graph

293 commits

Author SHA1 Message Date
Martin Lund
0a892006ea Unify error message formating 2022-06-11 23:36:51 +02:00
Martin Lund
77ff1e5269 Remove debug 2022-06-07 10:01:26 +02:00
Martin Lund
0a22142957 Update README 2022-06-07 07:27:11 +02:00
Martin Lund
989efeae88 Remove print of hex mode status at startup 2022-06-06 20:08:05 +02:00
Martin Lund
6d007d39d7 Remove newline option in hex mode 2022-06-06 19:38:31 +02:00
g0mb4
0b55981e52 Extended hexadecimal mode.
While in hex mode (ctrl-t h) you can output hexadecimal values.
E.g.: to send 0x0A you have to type 0A (always 2 characters).

Added option -x, --hex to start in hexadecimal mode.

Added option --newline-in-hex to interpret newline characters in hex mode.
This is disabled by default, because, in my opinion, hex stream is
fundamentally different from text, so a "new line" is meaningless in this
context.
2022-06-06 19:10:00 +02:00
Martin Lund
be2c682da6 Convert errors to warnings 2022-06-02 20:51:23 +02:00
Martin Lund
8da06ebf2c Fix typo 2022-05-15 20:21:58 +02:00
Peter Collingbourne
fb453160ef Add support for external control via a Unix domain socket.
This feature allows an external program to inject output into and
listen to input from a serial port via a Unix domain socket (path
specified via the -S/--socket command line flag, or the socket
config file option) while tio is running. This is useful for ad-hoc
scripting of serial port interactions while still permitting manual
control. Since many serial devices (at least on Linux) get confused
when opened by multiple processes, and most commands do not know
how to correctly open a serial device, this allows a more convenient
usage model than directly writing to the device node from an external
program.

Any input from clients connected to the socket is sent on the serial
port as if entered at the terminal where tio is running (except that
ctrl-t sequences are not recognized), and any input from the serial
port is multiplexed to the terminal and all connected clients.

Sockets remain open while the serial port is disconnected, and writes
will block.

Example usage 1 (issue a command):

  echo command | nc -UN /path/to/socket > /dev/null

Example usage 2 (use the expect command to script an interaction):

  #!/usr/bin/expect -f

  set timeout -1
  log_user 0

  spawn nc -UN /path/to/socket
  set uart $spawn_id

  send -i $uart "command1\n"
  expect -i $uart "prompt> "
  send -i $uart "command2\n"
  expect -i $uart "prompt> "
2022-04-18 14:06:33 -07:00
Martin Lund
28c880cdab Remove verbose option
Remove the command-line verbose option but let the ctrl-t c feature
print some of the verbose information (active config path/section).
2022-04-13 16:28:30 +02:00
Sylvain LAFRASSE
a543fbd7ef Factorize timestamp parsing to be coherent with command line format in configuration file. 2022-03-30 17:11:50 +02:00
Martin Lund
8965b7b42c Update headers 2022-03-11 15:15:39 +01:00
Martin Lund
b23397caa0 Fix text 2022-02-25 07:16:14 +01:00
Martin Lund
166d36d7d4 Correct text 2022-02-23 15:35:46 +01:00
Martin Lund
7ffeeccdf5 Merge branch 'osx-baudrate' of https://github.com/robey/tio into robey-osx-baudrate 2022-02-16 05:24:35 +01:00
Sylvain LAFRASSE
2d1e0f1233
Fix TTY device listing on Darwin. (#136) 2022-02-15 11:15:39 +01:00
Martin Lund
0e62995e6e Only apply color formatting when using color option
To help the color blind who may use custom terminal foreground /
background colors.
2022-02-15 00:48:10 +01:00
Martin Lund
274cb63197 Add '-c, --color' option
Allow user to select which ANSI color code to use to colorize the tio
text. To successfully set the color the color code must be in the range
0..255.

If color code is negative tio will print all available ANSI colors.

The default color is changed to bold white to make tio defaults usable
for most users, including color blind users.
2022-02-14 22:25:29 +01:00
Martin Lund
137b2823af Update headers 2022-02-13 06:35:03 +01:00
Martin Lund
2375bc0c7b Show auto connect status in show configuration 2022-02-13 05:46:31 +01:00
Martin Lund
5d031a51f9 Cleanup 2022-02-13 02:13:43 +01:00
Martin Lund
b6eac3f001 Improve printed output
Get rid of inconsistencies in the printed output (error printing,
colors, etc.).

Prepare for user configurable color.

Cleanup.
2022-02-12 22:47:42 +01:00
Martin Lund
16836de0e5 Update text 2022-02-12 04:27:09 +01:00
Martin Lund
e9208d693e Replace autotools with meson
To introduce much simpler build configuration which is also easier to
maintain.
2022-02-10 05:09:32 +01:00
Martin Lund
7a2a18232d Add list serial devices feature
For convenience, add a --list-devices option which lists the available
serial devices.
2022-02-08 23:13:34 +01:00
attila-v
65153c0d03
Refine timestamps with milliseconds and ISO-8601 format (#129).
* Show milliseconds too in the timestamp (#114) and log file (#124)
* Change timestamp format to ISO-8601.
Co-authored-by: Attila Veghelyi <aveghelyi@dension.com>
Co-authored-by: Sylvain LAFRASSE <sly74fr@users.noreply.github.com>
2022-02-07 17:18:36 +01:00
Sylvain LAFRASSE
febefa638f
Merge pull request #80 from marmidr/crlf
Newline: handle booth NL and CR
2022-02-02 17:36:01 +01:00
Robey Pointer
aa9f121a12 add support for high bps on OS X 2021-04-06 15:50:59 -07:00
Yin Fengwei
0f0279bd3f Output newline on stdout with hex print mode
This is to fix the issue #104. The timestamp will always be
printed at the beginning of line:

[10:25:56] Switched to hexadecimal mode
0d 0a 0d [10:25:57] 41 43 52 4e 3a 5c 3e 0d 0a 0d [10:25:58] 41

is changed to:

[12:34:56] 45 72 72 6f 72 3a 20 49 6e 76 61 6c 69 64 20
[12:34:56] 41 43 52 4e 3a 5c 3e
[12:34:56] 41 43 52 4e 3a 5c 3e
[12:34:57] 41 43 52 4e 3a 5c 3e 6c 73
2021-01-21 12:39:51 +08:00
Martin Lund
a4da50dbd8
Merge pull request #105 from zagor/show-error
Show error when failing to open a tty
2021-01-18 01:16:41 +01:00
Martin Lund
161f613e08
Merge pull request #96 from eerimoq/master
Exit if output speed cannot be set.
2021-01-18 01:13:42 +01:00
Martin Lund
50e33a1a5b
Merge branch 'master' into bug/92-fflush 2021-01-18 01:11:05 +01:00
Martin Lund
354bd6e185
Merge pull request #93 from larsks/bug/92
Disable line buffering in stdout
2021-01-18 01:09:35 +01:00
Martin Lund
3a1eea216a
Merge pull request #91 from geo-stark/master
add serial lines manual control
2021-01-18 01:08:09 +01:00
Martin Lund
6c86faf6f9
Merge pull request #86 from sly74fr/feature/TimestampsInLogFile_#84
Resolved tio/tio#84: Added timestamps in log file if enabled.
2021-01-18 01:05:12 +01:00
Björn Stenberg
71c1d7c540 Show error when failing to open a tty 2020-05-19 16:00:21 +02:00
Erik Moqvist
ad7b11e6e8 Exit if output speed cannot be set. 2019-10-19 17:08:04 +02:00
Lars Kellogg-Stedman
c6af6c0804 fflush() after putchar() for print_hex and print_normal
In order for local echo to work properly, we have to either call
fflush(stdout) after every character or just disable line buffering.
This change calls fflush() after putchar().

Closes #92
2019-10-16 22:48:44 -04:00
Lars Kellogg-Stedman
4d4ee466f7 Disable line buffering in stdout
In order for local echo to work properly, we have to either call
fflush(stdout) after every character or just disable line buffering.
This change uses setbuf(stdout, NULL) to do the latter.

Closes #92
2019-10-08 22:06:05 -04:00
George Stark
5217d9842b dont show line state if ioctl failed 2019-09-19 17:39:01 +03:00
George Stark
04d92740f5 add serial lines manual control 2019-09-19 15:13:38 +03:00
Sylvain LAFRASSE
a84f762106 Resolved tio/tio#84: Added timestamps in log file if enabled. 2019-05-24 10:46:02 +02:00
arichi
fca5429ae7 Flush every local echo char
Flush stdout at every char in case it
happens to be buffered.
2019-05-13 23:53:08 +08:00
Martin Lund
39a8f63640 Add command to show version
The key sequence ctrl-t v will now show the version of tio.
2018-11-27 23:56:34 +01:00
Martin Lund
42eb14dd77 Align format of timestamps 2018-11-27 23:38:21 +01:00
Mariusz Midor
18c2f7847e Newline: handle booth NL and CR
Flag ONLCRNL expects code \n after press Enter, but on some systems \r is send instead.
2018-11-12 19:16:51 +01:00
Martin Lund
a5d1546024 Minor code style cleanups 2018-11-03 16:40:59 +01:00
Robey Pointer
f96ad43b1f add optional timestamps
with "-t" or "C-t T", toggle a timestamp prefix to each line.
2018-11-01 17:23:57 -07:00
Martin Lund
14e70bd718 Flush output
Make sure output is transmitted immediately by flushing the output.
2018-10-21 02:07:55 +02:00
Sylvain LAFRASSE
3a024ca529 Made O_NONBLOCK flag to open() call specific to macOS only. 2018-09-04 20:56:21 +02:00