serial: set speed in both directions
This commit is contained in:
parent
6ac0db19f3
commit
6a6e23abf5
|
@ -234,6 +234,9 @@ SR_PRIV int serial_set_params(int fd, int baudrate, int bits, int parity,
|
||||||
struct termios term;
|
struct termios term;
|
||||||
speed_t baud;
|
speed_t baud;
|
||||||
|
|
||||||
|
if (tcgetattr(fd, &term) < 0)
|
||||||
|
return SR_ERR;
|
||||||
|
|
||||||
switch (baudrate) {
|
switch (baudrate) {
|
||||||
case 9600:
|
case 9600:
|
||||||
baud = B9600;
|
baud = B9600;
|
||||||
|
@ -255,8 +258,7 @@ SR_PRIV int serial_set_params(int fd, int baudrate, int bits, int parity,
|
||||||
default:
|
default:
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
if (cfsetospeed(&term, baud) < 0)
|
||||||
if (tcgetattr(fd, &term) < 0)
|
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
if (cfsetispeed(&term, baud) < 0)
|
if (cfsetispeed(&term, baud) < 0)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
Loading…
Reference in New Issue