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, 6 Jul 2020 15:59:04 +0200	[thread overview]
Message-ID: <20200706135904.GJ3453@localhost> (raw)
In-Reply-To: <61febd93-400b-d1f9-6fd9-82de0e799f3e@jrr.cz>

On Mon, Jul 06, 2020 at 01:47:50PM +0200, Jerry wrote:
> Johan Hovold wrote on 7/3/20 5:01 PM:
> > On Fri, Jul 03, 2020 at 09:45:39AM +0200, Johan Hovold wrote:
> > Would you mind giving the below a try and see how that works in your
> > setup?
> >
> > With this patch you'd be able to use PARMRK to be notified of any parity
> > errors, but I also wired up TIOCGICOUNT if you prefer to use that.
> >
> > Also, could try and see if your device detects breaks properly? Mine
> > just return a NUL char.

> I tried your patch. It detects the parity error correctly for my 
> application. Unfortunately I'm not able currently to verify a break 
> reception due to holiday, I'll probably try it next week when back at work 
> (I need to recompile the device firmware).

Cool, thanks.

I noticed that I can get comm-status to report a break condition when
event-insertion mode is disabled, but it just results in a NUL char in
event mode (the error flag isn't set then).

Perhaps buggy firmware, unless there's some other command for masking
events. Haven't quite understood how the EVENTMASK requests are supposed
to be used. Replacing the break char (SET_CHAR) didn't help at least.

> An interesting thing that your patch don't report any overrun. I'm not able 
> to create a real overrun (any idea?) but it doesn't report any fake overrun 
> compared to GET_COMM_STATUS.

Yeah, I noticed that too, although I had a feeling the fake overrun
didn't even always show up when sending while closed here either. 

Not sure how best to trigger an overrun since we rely on the read urb to
report it. Perhaps pausing the read urbs, filling up the device fifo and
then submitting the urbs again could work? Would need to patch the
driver quite a bit for that though.

> The question could be a value of CP210X_ESCCHAR. You selected 0xFF and this 
> value can be quite common in received data because an erased flash memory 
> is full of 0xFF. When I read an empty memory it means double USB bandwidth 
> so for example 0xFE seems be better... but I understand that it depend on 
> application and it is hard to globally select this value.

Good point! I think we should definitely avoid 0xff.

> I'll do some more tests but your solution seems be fully acceptable for my 
> needs. For me TIOCGICOUNT is enough (I just resend request when an error 
> detected) but for other situation it would be very nice to know exactly 
> which byte was malformed through PARMRK.

That's good to hear. I'll respin the generic (event-based) solution
then.

Thanks,
Johan

  reply	other threads:[~2020-07-06 13:59 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 [this message]
2020-07-08 21:05                             ` Jerry
2020-07-13 10:54                               ` Johan Hovold
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=20200706135904.GJ3453@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).