fix_serial_baudrate_set

Signed-off-by: geniusgogo <xpxyr@sina.com>
This commit is contained in:
geniusgogo 2024-05-07 15:29:31 +08:00 committed by Meco Man
parent 1e9ed637d8
commit 02e0334ac3

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