mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Invert line states to reflect true electrical level
This commit is contained in:
parent
10255d52d0
commit
6fee8514f4
1 changed files with 8 additions and 8 deletions
16
src/tty.c
16
src/tty.c
|
|
@ -440,12 +440,12 @@ static void toggle_line(const char *line_name, int mask, enum line_mode_t line_m
|
||||||
if (state & mask)
|
if (state & mask)
|
||||||
{
|
{
|
||||||
state &= ~mask;
|
state &= ~mask;
|
||||||
tio_printf("Setting %s to LOW", line_name);
|
tio_printf("Setting %s to HIGH", line_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
state |= mask;
|
state |= mask;
|
||||||
tio_printf("Setting %s to HIGH", line_name);
|
tio_printf("Setting %s to LOW", line_name);
|
||||||
}
|
}
|
||||||
if (ioctl(fd, TIOCMSET, &state) < 0)
|
if (ioctl(fd, TIOCMSET, &state) < 0)
|
||||||
tio_warning_printf("Could not set line state (%s)", strerror(errno));
|
tio_warning_printf("Could not set line state (%s)", strerror(errno));
|
||||||
|
|
@ -617,12 +617,12 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tio_printf("Line states:");
|
tio_printf("Line states:");
|
||||||
tio_printf(" DTR: %s", (state & TIOCM_DTR) ? "HIGH" : "LOW");
|
tio_printf(" DTR: %s", (state & TIOCM_DTR) ? "LOW" : "HIGH");
|
||||||
tio_printf(" RTS: %s", (state & TIOCM_RTS) ? "HIGH" : "LOW");
|
tio_printf(" RTS: %s", (state & TIOCM_RTS) ? "LOW" : "HIGH");
|
||||||
tio_printf(" CTS: %s", (state & TIOCM_CTS) ? "HIGH" : "LOW");
|
tio_printf(" CTS: %s", (state & TIOCM_CTS) ? "LOW" : "HIGH");
|
||||||
tio_printf(" DSR: %s", (state & TIOCM_DSR) ? "HIGH" : "LOW");
|
tio_printf(" DSR: %s", (state & TIOCM_DSR) ? "LOW" : "HIGH");
|
||||||
tio_printf(" DCD: %s", (state & TIOCM_CD) ? "HIGH" : "LOW");
|
tio_printf(" DCD: %s", (state & TIOCM_CD) ? "LOW" : "HIGH");
|
||||||
tio_printf(" RI : %s", (state & TIOCM_RI) ? "HIGH" : "LOW");
|
tio_printf(" RI : %s", (state & TIOCM_RI) ? "LOW" : "HIGH");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_F:
|
case KEY_F:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue