USB serial fixes for 7.3-rc4

Here are two fixes for a long-standing baud rate overflow issue in the
 two Quatech drivers and a new cp210x device id.
 
 Everything has been in linux-next with no reported issues.
 -----BEGIN PGP SIGNATURE-----
 
 iJEEABYKADkWIQQHbPq+cpGvN/peuzMLxc3C7H1lCAUCaqzi7BsUgAAAAAAEAA5t
 YW51MiwyLjUrMS4xMiwyLDIACgkQC8XNwux9ZQiFwwEAwWqNSEukRRgDzKQTW+Ul
 qXXj8KoHI3cA922rxDM6knYBAOkFG9I/IcnH/guMfIPjWj2kAX90mDLDw6VeSreI
 l8wM
 =4X25
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-7.3-rc4' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus

Johan writes:

USB serial fixes for 7.3-rc4

Here are two fixes for a long-standing baud rate overflow issue in the
two Quatech drivers and a new cp210x device id.

Everything has been in linux-next with no reported issues.

* tag 'usb-serial-7.3-rc4' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial:
  USB: serial: quatech2: fix baud rate overflow
  USB: serial: ssu100: fix baud rate overflow
  USB: serial: cp210x: add Corsair AX1500i Power Supply
This commit is contained in:
Greg Kroah-Hartman 2026-09-18 11:56:25 +01:00
commit abc36cbda2
3 changed files with 33 additions and 5 deletions

View File

@ -223,6 +223,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */
{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
{ USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
{ USB_DEVICE(0x1B1C, 0x1C02) }, /* Corsair AX1500i Power Supply */
{ USB_DEVICE(0x1B93, 0x1013) }, /* Phoenix Contact UPS Device */
{ USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
{ USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */

View File

@ -52,6 +52,7 @@
#define QT2_XMIT_FLUSH 0x05 /* no following info */
#define QT2_CONTROL_ESCAPE 0xff /* pass through previous 2 control bytes */
#define MIN_BAUD_RATE 50
#define MAX_BAUD_RATE 921600
#define DEFAULT_BAUD_RATE 9600
@ -156,7 +157,7 @@ static inline int calc_baud_divisor(int baudrate)
static inline int qt2_set_port_config(struct usb_device *dev,
unsigned char port_number,
u16 baudrate, u16 lcr)
speed_t baudrate, u16 lcr)
{
int divisor = calc_baud_divisor(baudrate);
u16 index = ((u16) (lcr << 8) | (u16) (port_number));
@ -257,9 +258,9 @@ static void qt2_set_termios(struct tty_struct *tty,
struct usb_device *dev = port->serial->dev;
struct qt2_port_private *port_priv;
struct ktermios *termios = &tty->termios;
u16 baud;
unsigned int cflag = termios->c_cflag;
u16 new_lcr = 0;
speed_t baud;
int status;
port_priv = usb_get_serial_port_data(port);
@ -277,6 +278,18 @@ static void qt2_set_termios(struct tty_struct *tty,
if (!baud)
baud = 9600;
if (baud < MIN_BAUD_RATE || baud > MAX_BAUD_RATE) {
if (old_termios)
baud = tty_termios_baud_rate(old_termios);
else
baud = clamp(baud, MIN_BAUD_RATE, MAX_BAUD_RATE);
tty_encode_baud_rate(tty, baud, baud);
if (!baud)
baud = 9600;
}
status = qt2_set_port_config(dev, port_priv->device_port, baud,
new_lcr);
if (status < 0)
@ -373,7 +386,7 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
port_priv->device_port = (u8) device_port;
if (tty)
qt2_set_termios(tty, port, &tty->termios);
qt2_set_termios(tty, port, NULL);
return 0;

View File

@ -32,6 +32,7 @@
#define SERIAL_EVEN_PARITY (UART_LCR_PARITY | UART_LCR_EPAR)
#define MIN_BAUD_RATE 50
#define MAX_BAUD_RATE 460800
#define ATC_DISABLED 0x00
@ -217,9 +218,10 @@ static void ssu100_set_termios(struct tty_struct *tty,
{
struct usb_device *dev = port->serial->dev;
struct ktermios *termios = &tty->termios;
u16 baud, divisor, remainder;
speed_t baud, remainder;
unsigned int cflag = termios->c_cflag;
u16 urb_value = 0; /* will hold the new flags */
u16 divisor;
int result;
if (cflag & PARENB) {
@ -235,6 +237,18 @@ static void ssu100_set_termios(struct tty_struct *tty,
if (!baud)
baud = 9600;
if (baud < MIN_BAUD_RATE || baud > MAX_BAUD_RATE) {
if (old_termios)
baud = tty_termios_baud_rate(old_termios);
else
baud = clamp(baud, MIN_BAUD_RATE, MAX_BAUD_RATE);
tty_encode_baud_rate(tty, baud, baud);
if (!baud)
baud = 9600;
}
dev_dbg(&port->dev, "%s - got baud = %d\n", __func__, baud);
@ -310,7 +324,7 @@ static int ssu100_open(struct tty_struct *tty, struct usb_serial_port *port)
dev_dbg(&port->dev, "%s - set uart failed\n", __func__);
if (tty)
ssu100_set_termios(tty, port, &tty->termios);
ssu100_set_termios(tty, port, NULL);
return usb_serial_generic_open(tty, port);
}