From: Sean Young <sean@mess.org>
To: "Marko Mäkelä" <marko.makela@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] media: rtl28xxu: improve IR receiver
Date: Mon, 27 Jun 2022 11:53:52 +0100 [thread overview]
Message-ID: <YrmMQNPHkDGZ843v@gofer.mess.org> (raw)
In-Reply-To: <YrhSK5l0uQZT76Fi@jyty>
Hi Marko,
On Sun, Jun 26, 2022 at 03:33:47PM +0300, Marko Mäkelä wrote:
> I finally took the time to get a deeper understanding of the infrared remote
> control subsystem. I think that I now understand the translation into
> key-down, key-up, and key-repeat events. For the RC5 protocol, rc_repeat()
> will not be called by ir-rc5-decoder.c but instead, ir_do_keydown() will
> handle the repeat. For lirc_scancode_event() it will never set the
> LIRC_SCANCODE_FLAG_REPEAT bit, even if !new_event and the protocol does
> support the toggle bit. That might qualify as a bug.
You are right, this was missed. Patches welcome.
> Sat, Feb 12, 2022 at 04:32:19PM +0000, Sean Young wrote:
> > This device presents an IR buffer, which can be read and cleared.
> > Clearing the buffer is racey with receiving IR, so wait until the IR
> > message is finished before clearing it.
> >
> > This should minimize the chance of the buffer clear happening while
> > IR is being received, although we cannot avoid this completely.
>
> I just realized that this limitation of the interface may be causing exactly
> what I was observing when I was testing this. If a constant stream of data
> is being received because a button is being held down, a buffer overflow or
> wrap-around glitch is inevitable, maybe expect if the wrap-around occurs
> exactly at the 128-byte boundary.
>
> How about the following improvement? If IR_RX_BC is a simple cursor to the
> 128-byte IR_RX_BUF, then rtl2832u_rc_query() could avoid sending
> refresh_tab[] but simply remember where the previous call left off. We could
> always read the 128 bytes at IR_RX_BUF, and process everything between the
> previous position reported by IR_RX_BC and the current position reported by
> IR_RX_BC, and treat buf[] as a ring buffer.
This is a great idea. Very original.
> Last time I tested it, the patch was a significant improvement. I think that
> "perfect" is the enemy of "good enough", and the patch should be included in
> the kernel.
The idea sounds really good. I'll review/test the patch and get back to you.
Thanks,
Sean
next prev parent reply other threads:[~2022-06-27 10:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-12 16:32 [PATCH 0/2] Fix rtl28xxu nec/rc5 receiver Sean Young
2022-02-12 16:32 ` [PATCH 1/2] media: rc-core: split IR timeout into rawir timeout and keyup delay Sean Young
2022-02-12 16:32 ` [PATCH 2/2] media: rtl28xxu: improve IR receiver Sean Young
2022-06-26 12:33 ` Marko Mäkelä
2022-06-27 5:00 ` Marko Mäkelä
2022-07-02 8:17 ` Sean Young
2022-06-27 10:53 ` Sean Young [this message]
2022-06-28 6:27 ` Marko Mäkelä
2022-07-02 8:14 ` Sean Young
2022-07-03 17:02 ` Marko Mäkelä
2022-07-04 7:21 ` Sean Young
2022-07-04 9:20 ` Marko Mäkelä
2022-07-04 10:00 ` Sean Young
2022-07-04 19:04 ` Marko Mäkelä
2022-07-05 7:25 ` Sean Young
2022-07-05 8:48 ` Marko Mäkelä
2022-07-05 9:26 ` Sean Young
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=YrmMQNPHkDGZ843v@gofer.mess.org \
--to=sean@mess.org \
--cc=linux-media@vger.kernel.org \
--cc=marko.makela@iki.fi \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.