tty: Add bitmask ioctls TIOCMBIS and TIOCMBIC
Equivalent to TIOCMSET + bitmask + TIOCMGET but with a single call. Gnokii uses that.
This commit is contained in:
parent
970910c21e
commit
0be89c15ee
@ -185,6 +185,8 @@ struct termios {
|
|||||||
#define TIOCMSET (TCGETA + 19) /* does TCSETDTR/TCSETRTS */
|
#define TIOCMSET (TCGETA + 19) /* does TCSETDTR/TCSETRTS */
|
||||||
#define TIOCSBRK (TCGETA + 20) /* set txd pin */
|
#define TIOCSBRK (TCGETA + 20) /* set txd pin */
|
||||||
#define TIOCCBRK (TCGETA + 21) /* both are a frontend to TCSBRK */
|
#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 */
|
/* Event codes. Returned from TCWAITEVENT */
|
||||||
#define EV_RING 0x0001
|
#define EV_RING 0x0001
|
||||||
|
@ -1756,6 +1756,26 @@ tty_control(tty_cookie* cookie, uint32 op, void* buffer, size_t length)
|
|||||||
return user_memcpy(buffer, &bits, sizeof(bits));
|
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 TIOCSBRK:
|
||||||
case TIOCCBRK:
|
case TIOCCBRK:
|
||||||
case TCSBRK:
|
case TCSBRK:
|
||||||
|
Loading…
Reference in New Issue
Block a user