When a baud rate of 0 is requested, both the 8250 driver and the FTDI driver reset the baud rate to the default of 9600 (see the comment above the uart_get_baud_rate function). Some old versions of the NXP blhost utility depend on this behavior. However, the CP210x driver resets the baud rate to the minimum supported rate of 300. Special-case B0 so that it returns the baud rate to the more sensible default of 9600. Signed-off-by: Alex Henrie <alexh@xxxxxxxxxxx> --- drivers/usb/serial/cp210x.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 3bcec419f463..2c910550dca8 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -1051,9 +1051,14 @@ static void cp210x_change_speed(struct tty_struct *tty, * This maps the requested rate to the actual rate, a valid rate on * cp2102 or cp2103, or to an arbitrary rate in [1M, max_speed]. * - * NOTE: B0 is not implemented. + * NOTE: B0 is not implemented, apart from returning the baud rate to + * the default of B9600. */ - baud = clamp(tty->termios.c_ospeed, priv->min_speed, priv->max_speed); + if (tty->termios.c_ospeed) { + baud = clamp(tty->termios.c_ospeed, priv->min_speed, priv->max_speed); + } else { + baud = 9600; + } if (priv->use_actual_rate) baud = cp210x_get_actual_rate(baud); @@ -1069,7 +1074,8 @@ static void cp210x_change_speed(struct tty_struct *tty, baud = 9600; } - tty_encode_baud_rate(tty, baud, baud); + if (tty->termios.c_ospeed) + tty_encode_baud_rate(tty, baud, baud); } static void cp210x_enable_event_mode(struct usb_serial_port *port) -- 2.38.1