Commit graph

31 commits

Author SHA1 Message Date
Martin Lund
46b5783789 Rework color option
Rework the color option to support setting ANSI color code values
ranging from 0..255 or "none" for no color or "list" to print a list of
available ANSI colors codes.

Also, disables color when piping.
2022-06-08 16:19:47 +02:00
Martin Lund
0a22142957 Update README 2022-06-07 07:27:11 +02:00
Martin Lund
b0b0856a8b Print socket info at startup 2022-04-20 19:20:26 +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
03cf4ef197 Handle SIGHUP
Handle SIGHUP so that the registered exit handlers are called to restore
the terminal back to its orignal state.
2022-03-18 19:19:11 +01:00
Martin Lund
8965b7b42c Update headers 2022-03-11 15:15:39 +01:00
Martin Lund
a2b164519f Mostly cosmetic updates 2022-03-11 15:11:43 +01:00
Liam Beguin
2e5c1ff20c add support for a configuration file
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
2022-03-10 10:34:52 -05: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
137b2823af Update headers 2022-02-13 06:35:03 +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
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
Martin Lund
342a247efb Reconfigure stdin
Make stdin behave more raw'ish. In particular, don't
translate CR -> NL on input.
2017-11-06 14:43:56 +01:00
Martin Lund
f5e6c99721 Update copyright headers 2017-09-28 18:15:07 +02:00
Martin Lund
e920cc9b32 Introduced tty_configure()
Moved tty configuration actions to tty_configure() in tty.c. This way
options.c is strictly about parsing options nothing else.
2016-05-23 18:03:13 +02:00
Martin Lund
1f45b8d91d Function names cleanup 2016-05-23 08:50:47 +02:00
Jakob Haufe
82063b73fb
Include config.h before standard headers
This makes use of 8d6d202 (Enable large file support) for real.
2016-05-21 21:15:33 +02:00
Martin Lund
156f06c711 Updated tio title 2016-05-16 15:31:56 +02:00
Martin Lund
ad551b363e Cleanup of error handling
Introduced consistent way of handling errors and printing error messages.

Also upgraded some warnings to errors.
2016-05-09 17:28:43 +02:00
Martin Lund
ece9e7f918 Improved error handling
Fixes a memory leak and avoids aggressive busy looping when problems
accessing tty device.
2016-05-08 00:37:27 +02:00
Martin Lund
4c59995db8 Removed redundant log_close() call 2016-05-08 00:32:11 +02:00
Martin Lund
9dd21af867 Renamed "gotty" to "tio"
Renamed to "tio" because it is shorter and this new name also more
precisely reflects what the program is - a simple TTY terminal I/O
application.

"tio" can be considered short for terminal I/O or TTY I/O or a
combination of the two, whichever you prefer.

Also, wanted to avoid naming conflicts with other projects.
2016-05-04 20:20:06 +02:00
Martin Lund
bbda0b8851 Added log feature
Added "--log <filename>" option which writes all activity to specified
file.
2016-05-01 21:21:05 +02:00
Martin Lund
c6c4a4b1dd Minor cleanup 2016-04-24 09:20:27 +02:00
Jakob Haufe
f01eeb049e
Add missing include 2016-04-23 21:34:25 +02:00
Martin Lund
9dfb1debaf Fixed disconnect output
In certain cases the disconnect message would eat a line of output from
the tty device (if any). This is now fixed.
2014-09-30 01:18:29 +02:00
Martin Lund
6e2582787c Fixed not being able to quit
When gotty was waiting for a device to appear it was impossible to quit
using the ctrl-g ctrl-q sequence. This is now fixed.
2014-09-27 22:18:07 +02:00
Martin Lund
a14d14d75b Initial import 2014-09-27 11:35:17 +02:00