Update README

This commit is contained in:
Martin Lund 2022-06-07 07:26:40 +02:00
parent 10199f6053
commit 0a22142957
3 changed files with 16 additions and 7 deletions

View file

@ -114,13 +114,13 @@ color = 10
tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0 tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
baudrate = 9600 baudrate = 9600
no-autoconnect = enable no-autoconnect = enable
log = enable
log-filename = ftdi.log
color = 12 color = 12
[usb devices] [usb devices]
pattern = usb([0-9]*) pattern = usb([0-9]*)
tty = /dev/ttyUSB%s tty = /dev/ttyUSB%s
log = enable
log-filename = usb.log
color = 13 color = 13
``` ```

View file

@ -60,10 +60,16 @@ int main(int argc, char *argv[])
tty_configure(); tty_configure();
/* Configure input terminal */ /* Configure input terminal */
if (isatty(fileno(stdin)))
{
stdin_configure(); stdin_configure();
}
/* Configure output terminal */ /* Configure output terminal */
if (isatty(fileno(stdout)))
{
stdout_configure(); stdout_configure();
}
/* Add log exit handler */ /* Add log exit handler */
atexit(&log_exit); atexit(&log_exit);

View file

@ -583,12 +583,15 @@ void tty_wait_for_device(void)
if (FD_ISSET(STDIN_FILENO, &rdfs)) if (FD_ISSET(STDIN_FILENO, &rdfs))
{ {
/* Input from stdin ready */ /* Input from stdin ready */
printf(".\n");
fflush(stdout);
/* Read one character */ /* Read one character */
status = read(STDIN_FILENO, &input_char, 1); status = read(STDIN_FILENO, &input_char, 1);
if (status <= 0) if (status <= 0)
{ {
error_printf("Could not read from stdin"); error_printf("Could not read from stdin 0");
error_printf("Could not read from stdin 0 (%s)", strerror(errno));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -820,7 +823,7 @@ int tty_connect(void)
} else } else
{ {
/* Error reading - device is likely unplugged */ /* Error reading - device is likely unplugged */
error_printf_silent("Could not read from tty device"); error_printf_silent("Could not read from tty device 1");
goto error_read; goto error_read;
} }
} }
@ -832,7 +835,7 @@ int tty_connect(void)
status = read(STDIN_FILENO, &input_char, 1); status = read(STDIN_FILENO, &input_char, 1);
if (status <= 0) if (status <= 0)
{ {
error_printf_silent("Could not read from stdin"); error_printf_silent("Could not read from stdin 2");
goto error_read; goto error_read;
} }