[drivers][serial]fix error in getting serial_tty settings (#8953)

fix error in getting serial_tty settings
This commit is contained in:
zms123456 2024-05-16 15:36:16 +08:00 committed by GitHub
parent ec8ff90a4a
commit ed002bb84a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -179,11 +179,13 @@ static void _serial_tty_set_speed(struct lwp_tty *tp)
{ {
struct serial_tty_context *softc = (struct serial_tty_context *)(tp->t_devswsoftc); struct serial_tty_context *softc = (struct serial_tty_context *)(tp->t_devswsoftc);
struct rt_serial_device *serial; struct rt_serial_device *serial;
struct termios serial_hw_config;
RT_ASSERT(softc); RT_ASSERT(softc);
serial = softc->parent; serial = softc->parent;
rt_device_control(&(serial->parent), TCGETS, &tp->t_termios_init_in); rt_device_control(&(serial->parent), TCGETS, &serial_hw_config);
tp->t_termios_init_in.c_cflag |= serial_hw_config.c_cflag;
tp->t_termios_init_in.__c_ispeed = tp->t_termios_init_in.__c_ospeed = cfgetospeed(&tp->t_termios_init_in); tp->t_termios_init_in.__c_ispeed = tp->t_termios_init_in.__c_ospeed = cfgetospeed(&tp->t_termios_init_in);
} }