fix_serial_baudrate_set

This commit is contained in:
geniusgogo 2024-05-08 10:32:05 +08:00 committed by Meco Man
parent f770f543a6
commit 79b3d5ec1e
2 changed files with 2 additions and 4 deletions

View File

@ -1148,8 +1148,6 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
{
_termios_to_termio(tio, args);
}
tio->__c_ispeed = tio->__c_ospeed = cfgetospeed(tio);
}
break;
case TCSETAW:
@ -1176,8 +1174,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
if (tio == RT_NULL) return -RT_EINVAL;
config = serial->config;
tio->__c_ispeed = tio->__c_ospeed = cfgetospeed(tio);
baudrate = _get_baudrate(tio->__c_ispeed);
baudrate = _get_baudrate(cfgetospeed(tio));
config.baud_rate = baudrate;
switch (tio->c_cflag & CSIZE)

View File

@ -296,6 +296,7 @@ static int serial_tty_param(struct lwp_tty *tp, struct termios *t)
RT_ASSERT(softc);
serial = softc->parent;
cfsetispeed(t, t->__c_ispeed);
return rt_device_control(&(serial->parent), TCSETS, t);
}