From: Johan Hovold <johan@kernel.org>
To: Florian Zumbiehl <florz@florz.de>
Cc: Johan Hovold <johan@kernel.org>, linux-usb@vger.kernel.org
Subject: usbserial: pl2303 tx xon/xoff flow control
Date: Wed, 16 May 2018 15:28:40 +0200 [thread overview]
Message-ID: <20180516132840.GE30172@localhost> (raw)
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@florz.de>
> ---
> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2018-05-16 13:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 13:28 Johan Hovold [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-05-21 8:45 usbserial: pl2303 tx xon/xoff flow control Johan Hovold
2018-05-18 13:16 Johan Hovold
2018-05-18 13:09 Johan Hovold
2018-05-18 4:06 Florian Zumbiehl
2018-05-18 4:06 Florian Zumbiehl
2018-05-17 9:19 Johan Hovold
2018-05-17 8:29 Johan Hovold
2018-05-17 3:39 Florian Zumbiehl
2018-05-14 3:15 Florian Zumbiehl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180516132840.GE30172@localhost \
--to=johan@kernel.org \
--cc=florz@florz.de \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).