Re: [PATCH] usbserial: pl2303 tx xon/xoff flow control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 14, 2018 at 05:15:11AM +0200, Florian Zumbiehl wrote:
> Support hardware-level Xon/Xoff flow control in transmit direction with
> pl2303.
> 
> Signed-off-by: Florian Zumbiehl <florz@xxxxxxxx>
> ---
> 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?

> --- linux-4.16.8/drivers/usb/serial/pl2303.c.orig	2018-05-09 09:53:14.000000000 +0200
> +++ linux-4.16.8/drivers/usb/serial/pl2303.c	2018-05-14 04:32:27.860780856 +0200
> @@ -544,8 +544,12 @@ static void pl2303_set_termios(struct tt
>  	int 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).

> +			return;

Odd indentation (which checkpatch would have caught).

>  
>  	buf = kzalloc(7, GFP_KERNEL);
>  	if (!buf) {
> @@ -662,6 +666,9 @@ static void pl2303_set_termios(struct tt
>  			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) {

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.

> +			pl2303_vendor_write(serial, 0x0, 0xc0);

Odd indentation again.

>  	} 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux