Added a shorter implementation for the serial_set_status function.
This commit is contained in:
parent
0154674573
commit
425efd1c0d
@ -564,18 +564,9 @@ serial_send_break (serial *device)
|
||||
static int
|
||||
serial_set_status (int fd, int value, int level)
|
||||
{
|
||||
int bits;
|
||||
if (ioctl (fd, TIOCMGET, &bits)) {
|
||||
TRACE ("ioctl");
|
||||
return -1;
|
||||
}
|
||||
int action = (level ? TIOCMBIS : TIOCMBIC);
|
||||
|
||||
if (level)
|
||||
bits |= value;
|
||||
else
|
||||
bits &= value;
|
||||
|
||||
if (ioctl (fd, TIOCMSET, &bits)) {
|
||||
if (ioctl (fd, action, &value) != 0) {
|
||||
TRACE ("ioctl");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user