usbserial: pl2303 tx xon/xoff flow control
Quoted 9 lines · Florian Zumbiehl
Support hardware-level Xon/Xoff flow control in transmit direction with pl2303.
Signed-off-by Florian Zumbiehl <[email protected]>---
Note that the patch has only been fully tested with kernel 4.9.28, and test-compiled against 4.16.8. Tested only with the pl2303 adapters I have available (which seem to be type 0 if I interpret the code correctly), I don't have a clue whether this works with other versions of the chip.
What's the usb-devices (or lsusb -v) output for your device?
drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tt · line 551
Quoted 13 lines
drivers/usb/serial/pl2303.c renamed from drivers/usb/serial/pl2303.c.orig +5
-2@@ -544,8 +544,12 @@ static void pl2303_set_termios(struct ttint ret;u8 control; -if (old_termios && !tty_termios_hw_change (&tty->termios, old_termios)) -return ; +if (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 ]))
Use a helper function for this (if everything is indeed needed, see below).
drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tt · line 552
Quoted 1 line
drivers/usb/serial/pl2303.c renamed from drivers/usb/serial/pl2303.c.orig +1
-0+return ;
Odd indentation (which checkpatch would have caught).
drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tt · line 670
Quoted 9 lines
drivers/usb/serial/pl2303.c renamed from drivers/usb/serial/pl2303.c.orig +2
-0buf =kzalloc (7 ,GFP_KERNEL );if (!buf) {@@ -662,6 +666,9 @@ static void pl2303_set_termios(struct ttpl2303_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 ) {
If the device does not support IXANY, I think you should just clear that bit to indicate lack of support.
And the start and stop characters cannot be modified (as far as you know)? Then we should probably set these in the termios whenever IXON is set as well since usbserial does not support falling back to the line-discipline IXON implementation.
drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tt · line 671
Quoted 1 line
drivers/usb/serial/pl2303.c renamed from drivers/usb/serial/pl2303.c.orig +1
-0+pl2303_vendor_write (serial,0x0 ,0xc0 );
Odd indentation again.
drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tt · line 674
Quoted 3 lines
drivers/usb/serial/pl2303.c renamed from drivers/usb/serial/pl2303.c.orig +0
-0}else {pl2303_vendor_write (serial,0x0 ,0x0 ); }
Thanks,
Johan
---
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