Support hardware-level Xon/Xoff flow control in transmit direction with
pl2303.

I only know how to get the hardware to do IXON/!IXANY with ^S/^Q as control
characters, so I preserve the old behaviour for all other cases.

Signed-off-by: Florian Zumbiehl <[email protected]>
---
--- linux-4.16.9/drivers/usb/serial/pl2303.c.orig       2018-05-20 
00:51:34.580966124 +0200
+++ linux-4.16.9/drivers/usb/serial/pl2303.c    2018-05-20 01:16:49.532730098 
+0200
@@ -539,12 +539,18 @@
        struct usb_serial *serial = port->serial;
        struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
        struct pl2303_private *priv = usb_get_serial_port_data(port);
+       bool termios_unchanged;
        unsigned long flags;
        unsigned char *buf;
        int ret;
        u8 control;
 
-       if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
+       termios_unchanged = old_termios &&
+               !(tty_termios_hw_change(&tty->termios, old_termios) ||
+                 ((tty->termios.c_iflag ^ old_termios->c_iflag) & (IXON | 
IXANY)) ||
+                 tty->termios.c_cc[VSTOP] != old_termios->c_cc[VSTOP] ||
+                 tty->termios.c_cc[VSTART] != old_termios->c_cc[VSTART]);
+       if (termios_unchanged)
                return;
 
        buf = kzalloc(7, GFP_KERNEL);
@@ -662,6 +668,10 @@
                        pl2303_vendor_write(serial, 0x0, 0x41);
                else
                        pl2303_vendor_write(serial, 0x0, 0x61);
+       } else if (I_IXON(tty) && !I_IXANY(tty) &&
+                       START_CHAR(tty) == 0x11 &&
+                       STOP_CHAR(tty) == 0x13) {
+               pl2303_vendor_write(serial, 0x0, 0xc0);
        } else {
                pl2303_vendor_write(serial, 0x0, 0x0);
        }
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to