From 02e0334ac3dacca463c36bcbb7f71b0f35c2af85 Mon Sep 17 00:00:00 2001 From: geniusgogo Date: Tue, 7 May 2024 15:29:31 +0800 Subject: [PATCH] fix_serial_baudrate_set Signed-off-by: geniusgogo --- components/drivers/serial/serial.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 761cf4973d..1e8763368d 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1148,6 +1148,8 @@ 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: @@ -1174,7 +1176,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); config.baud_rate = baudrate;