linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Jerry <Jerry@jrr.cz>
Cc: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH v4] usbserial: cp210x - icount support for parity error checking
Date: Mon, 13 Jul 2020 12:54:11 +0200	[thread overview]
Message-ID: <20200713105411.GW3453@localhost> (raw)
In-Reply-To: <3fc7bd0e-6cf6-140c-592f-b8c69d483309@jrr.cz>

On Wed, Jul 08, 2020 at 11:05:29PM +0200, Jerry wrote:
> Johan Hovold wrote on 7/6/20 3:59 PM:
> > On Mon, Jul 06, 2020 at 01:47:50PM +0200, Jerry wrote:
> >> Johan Hovold wrote on 7/3/20 5:01 PM:
> >>> Also, could try and see if your device detects breaks properly? Mine
> >>> just return a NUL char.

> I've done some experiments with CP2102 receiving a break.
> It seems that chip always receives 0x00 for the start of break (with 
> correct parity when even parity set, wrong for odd parity) and later 
> (probably after 250 ms) it also sets break flag in GET_COMM_STATUS.
> I don't see any indication of the break event in data. I tried to change 
> some things in your solution but without success.

Ok, thanks for testing! The SERIAL_BREAK_CHAR in ulFlowReplace probably
needs to be set for breaks to be reported in-band, but unfortunately
that doesn't seem to have any effect on CP2102.

> I also haven't ever seen Frame error (neither way). I tried several ways 
> (different tx/rx baudrate, receive a parity data without parity enabled, 
> generating shorter breaks) and I suppose that CP2102 can't indicate framing 
> error.
> 
> Luckily I haven't found any problem with parity checking.  :-)

That's good.

I've been giving this some more thought and decided that it's probably
best not to extend TIOCGICOUNT with a COMM_STATUS request after all.

TIOCGICOUNT is really only supposed to be used to retrieve the
modem-status interrupts in concert with TIOCMIWAIT, but the ioctl was
later amended with some error statistics as well. As I mentioned before,
the ioctl is linux-specific and the statistics counter are mostly
undocumented and the behaviour varies from driver to driver. And don't
think adding another device-specific implementation which essentially
polls for errors (rather than counts them) is a good idea.

Since you confirmed that the event based implementation works for your
use case I think we should stick to that as it's allows for the normal
POSIX mechanisms for detecting parity errors.

Johan

  reply	other threads:[~2020-07-13 10:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 19:58 [PATCH 1/1] usbserial: cp210x - icount support for parity error checking Jerry
2020-06-21  8:54 ` [PATCH v2] " Jerry
2020-06-21  8:58 ` [PATCH 1/1] " Greg Kroah-Hartman
2020-06-21  9:45   ` Jerry
2020-06-21  9:55     ` Greg Kroah-Hartman
2020-06-21 10:34       ` Jerry
2020-06-21 13:58         ` Greg Kroah-Hartman
2020-06-21 20:21           ` [PATCH v3] " Jaromír Škorpil
2020-06-22  5:31             ` Greg Kroah-Hartman
2020-06-22 15:13               ` [PATCH v4] " Jaromír Škorpil
2020-06-25  4:31                 ` Jerry
2020-06-25  6:53                   ` Johan Hovold
2020-07-01 15:42                 ` Johan Hovold
2020-07-01 19:28                   ` Jerry
2020-07-03  7:45                     ` Johan Hovold
2020-07-03 15:01                       ` Johan Hovold
2020-07-06 11:47                         ` Jerry
2020-07-06 13:59                           ` Johan Hovold
2020-07-08 21:05                             ` Jerry
2020-07-13 10:54                               ` Johan Hovold [this message]
2020-07-03 18:45                       ` Jerry
2020-07-06  7:51                         ` Johan Hovold
2020-07-06  9:08                 ` Johan Hovold
2020-07-08 21:34                   ` [PATCH v5] " Jaromir Skorpil
2020-07-08 22:21                   ` Jaromir Skorpil
2020-06-22  4:38           ` [PATCH 1/1] " Jerry
2020-06-22  5:30             ` Greg Kroah-Hartman
2020-06-22 16:50               ` Jerry

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=20200713105411.GW3453@localhost \
    --to=johan@kernel.org \
    --cc=Jerry@jrr.cz \
    --cc=gregkh@linuxfoundation.org \
    --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).