Rename EOL delay to Output line delay

This commit is contained in:
Martin Lund 2022-07-11 14:08:12 +02:00
parent 8b8dd373a7
commit 39af74f263
7 changed files with 45 additions and 40 deletions

View file

@ -16,6 +16,7 @@ _tio()
-s --stopbits \
-p --parity \
-o --output-delay \
-o --output-line-delay \
--dtr-pulse-duration \
-n --no-autoconnect \
-e --local-echo \
@ -56,7 +57,11 @@ _tio()
return 0
;;
-o | --output-delay)
COMPREPLY=( $(compgen -W "0 1 10 100" -- ${cur}) )
COMPREPLY=( $(compgen -W "1 10 100" -- ${cur}) )
return 0
;;
-O | --output-line-delay)
COMPREPLY=( $(compgen -W "1 10 100" -- ${cur}) )
return 0
;;
--dtr-pulse-duration)
@ -75,11 +80,11 @@ _tio()
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-l | --log-file)
--log-file)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-l | --log-strip)
--log-strip)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;

View file

@ -124,9 +124,9 @@ static int data_handler(void *user, const char *section, const char *name,
{
option.output_delay = atoi(value);
}
else if (!strcmp(name, "eol-delay"))
else if (!strcmp(name, "output-line-delay"))
{
option.eol_delay = atoi(value);
option.output_line_delay = atoi(value);
}
else if (!strcmp(name, "dtr-pulse-duration"))
{

View file

@ -55,8 +55,8 @@ struct option_t option =
.stopbits = 1,
.parity = "none",
.output_delay = 0,
.output_line_delay = 0,
.dtr_pulse_duration = 100,
.eol_delay = 0,
.no_autoconnect = false,
.log = false,
.log_filename = NULL,
@ -76,28 +76,28 @@ void print_help(char *argv[])
printf("Connect to tty device directly or via sub-configuration.\n");
printf("\n");
printf("Options:\n");
printf(" -b, --baudrate <bps> Baud rate (default: 115200)\n");
printf(" -d, --databits 5|6|7|8 Data bits (default: 8)\n");
printf(" -f, --flow hard|soft|none Flow control (default: none)\n");
printf(" -s, --stopbits 1|2 Stop bits (default: 1)\n");
printf(" -p, --parity odd|even|none|mark Parity (default: none)\n");
printf(" -o, --output-delay <ms> Output delay (default: 0)\n");
printf(" -O, --eol-delay <ms> EOL output delay (default: 0)\n");
printf(" --dtr-pulse-duration <ms> DTR pulse duration (default: 100)\n");
printf(" -n, --no-autoconnect Disable automatic connect\n");
printf(" -e, --local-echo Enable local echo\n");
printf(" -t, --timestamp Enable line timestamp\n");
printf(" --timestamp-format <format> Set timestamp format (default: 24hour)\n");
printf(" -L, --list-devices List available serial devices\n");
printf(" -l, --log Enable log to file\n");
printf(" --log-file <filename> Set log filename\n");
printf(" --log-strip Strip control characters and escape sequences\n");
printf(" -m, --map <flags> Map characters\n");
printf(" -c, --color 0..255|none|list Colorize tio text (default: 15)\n");
printf(" -S, --socket <socket> Redirect I/O to file or network socket\n");
printf(" -x, --hexadecimal Enable hexadecimal mode\n");
printf(" -v, --version Display version\n");
printf(" -h, --help Display help\n");
printf(" -b, --baudrate <bps> Baud rate (default: 115200)\n");
printf(" -d, --databits 5|6|7|8 Data bits (default: 8)\n");
printf(" -f, --flow hard|soft|none Flow control (default: none)\n");
printf(" -s, --stopbits 1|2 Stop bits (default: 1)\n");
printf(" -p, --parity odd|even|none|mark|space Parity (default: none)\n");
printf(" -o, --output-delay <ms> Output character delay (default: 0)\n");
printf(" -O, --output-line-delay <ms> Output line delay (default: 0)\n");
printf(" --dtr-pulse-duration <ms> DTR pulse duration (default: 100)\n");
printf(" -n, --no-autoconnect Disable automatic connect\n");
printf(" -e, --local-echo Enable local echo\n");
printf(" -t, --timestamp Enable line timestamp\n");
printf(" --timestamp-format <format> Set timestamp format (default: 24hour)\n");
printf(" -L, --list-devices List available serial devices\n");
printf(" -l, --log Enable log to file\n");
printf(" --log-file <filename> Set log filename\n");
printf(" --log-strip Strip control characters and escape sequences\n");
printf(" -m, --map <flags> Map characters\n");
printf(" -c, --color 0..255|none|list Colorize tio text (default: 15)\n");
printf(" -S, --socket <socket> Redirect I/O to file or network socket\n");
printf(" -x, --hexadecimal Enable hexadecimal mode\n");
printf(" -v, --version Display version\n");
printf(" -h, --help Display help\n");
printf("\n");
printf("Options and sub-configurations may be set via configuration file.\n");
printf("\n");
@ -174,7 +174,7 @@ void options_print()
tio_printf(" Local echo: %s", option.local_echo ? "enabled" : "disabled");
tio_printf(" Timestamp: %s", timestamp_state_to_string(option.timestamp));
tio_printf(" Output delay: %d", option.output_delay);
tio_printf(" EOL delay: %d", option.eol_delay);
tio_printf(" Output line delay: %d", option.output_line_delay);
tio_printf(" DTR pulse duration: %d", option.dtr_pulse_duration);
tio_printf(" Auto connect: %s", option.no_autoconnect ? "disabled" : "enabled");
if (option.map[0] != 0)
@ -205,7 +205,7 @@ void options_parse(int argc, char *argv[])
{"stopbits", required_argument, 0, 's' },
{"parity", required_argument, 0, 'p' },
{"output-delay", required_argument, 0, 'o' },
{"eol-delay", required_argument, 0, 'O' },
{"output-line-delay", required_argument, 0, 'O' },
{"dtr-pulse-duration", required_argument, 0, OPT_DTR_PULSE_DURATION},
{"no-autoconnect", no_argument, 0, 'n' },
{"local-echo", no_argument, 0, 'e' },
@ -271,7 +271,7 @@ void options_parse(int argc, char *argv[])
break;
case 'O':
option.eol_delay = string_to_long(optarg);
option.output_line_delay = string_to_long(optarg);
break;
case OPT_DTR_PULSE_DURATION:

View file

@ -48,8 +48,8 @@ struct option_t
int stopbits;
char *parity;
int output_delay;
int output_line_delay;
int dtr_pulse_duration;
int eol_delay;
bool no_autoconnect;
bool log;
bool log_strip;

View file

@ -158,7 +158,7 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
}
}
if (option.output_delay || option.eol_delay)
if (option.output_delay || option.output_line_delay)
{
// Write byte by byte with output delay
for (i=0; i<count; i++)
@ -172,9 +172,9 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
}
bytes_written += retval;
if (option.eol_delay && *(unsigned char*)buffer == '\r')
if (option.output_line_delay && *(unsigned char*)buffer == '\r')
{
delay(option.eol_delay);
delay(option.output_line_delay);
}
fsync(fd);