mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Enter non-interactive mode when piping to tio
Add support for a non interactive mode which allows other application to 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 in the incoming stream. This allows users to pipe binary data directly to the connected serial device. Example use: $ cat commands.txt | tio /dev/ttyUSB0
This commit is contained in:
parent
a37ad26a88
commit
dba77eb912
3 changed files with 27 additions and 9 deletions
12
src/main.c
12
src/main.c
|
|
@ -59,6 +59,11 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
stdin_configure();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enter non interactive mode
|
||||
interactive_mode = false;
|
||||
}
|
||||
|
||||
/* Configure output terminal */
|
||||
if (isatty(fileno(stdout)))
|
||||
|
|
@ -85,7 +90,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Print launch hints */
|
||||
tio_printf("tio v%s", VERSION);
|
||||
tio_printf("Press ctrl-t q to quit");
|
||||
if (interactive_mode)
|
||||
{
|
||||
tio_printf("Press ctrl-t q to quit");
|
||||
}
|
||||
|
||||
/* Open socket */
|
||||
if (option.socket)
|
||||
|
|
@ -94,7 +102,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Connect to tty device */
|
||||
if (option.no_autoconnect)
|
||||
if ((option.no_autoconnect) || (!interactive_mode))
|
||||
{
|
||||
status = tty_connect();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue