diff --git a/headers/posix/termios.h b/headers/posix/termios.h index b56c5955e3..3aff5b945c 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -185,6 +185,8 @@ struct termios { #define TIOCMSET (TCGETA + 19) /* does TCSETDTR/TCSETRTS */ #define TIOCSBRK (TCGETA + 20) /* set txd pin */ #define TIOCCBRK (TCGETA + 21) /* both are a frontend to TCSBRK */ +#define TIOCMBIS (TCGETA + 22) /* set bits in line state */ +#define TIOCMBIC (TCGETA + 23) /* clear bits in line state */ /* Event codes. Returned from TCWAITEVENT */ #define EV_RING 0x0001 diff --git a/src/add-ons/kernel/generic/tty/tty.cpp b/src/add-ons/kernel/generic/tty/tty.cpp index 7d978e23b6..72d9cb91af 100644 --- a/src/add-ons/kernel/generic/tty/tty.cpp +++ b/src/add-ons/kernel/generic/tty/tty.cpp @@ -1756,6 +1756,26 @@ tty_control(tty_cookie* cookie, uint32 op, void* buffer, size_t length) return user_memcpy(buffer, &bits, sizeof(bits)); } + case TIOCMBIS: + case TIOCMBIC: + { + // control line state setting, we only support DTR and RTS + int value; + if (user_memcpy(&value, buffer, sizeof(value)) != B_OK) + return B_BAD_ADDRESS; + + bool result = false; + bool dtr = (op == TIOCMBIS); + if (value & TIOCM_DTR) + result = tty->service_func(tty, TTYSETDTR, &dtr, sizeof(dtr)); + + bool rts = (op == TIOCMBIS); + if (value & TIOCM_RTS) + result = tty->service_func(tty, TTYSETRTS, &rts, sizeof(rts)); + + return result ? B_OK : B_ERROR; + } + case TIOCSBRK: case TIOCCBRK: case TCSBRK: