From: "Marko Mäkelä" <marko.makela@iki.fi>
To: Sean Young <sean@mess.org>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] media: rtl28xxu: improve IR receiver
Date: Sun, 26 Jun 2022 15:33:47 +0300 [thread overview]
Message-ID: <YrhSK5l0uQZT76Fi@jyty> (raw)
In-Reply-To: <704b3d7e5a7a95cbd5e4dfc25a41454e919aed95.1644683294.git.sean@mess.org>
Hi Sean,
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.
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.
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.
Best regards,
Marko
next prev parent reply other threads:[~2022-06-26 12:33 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ä [this message]
2022-06-27 5:00 ` Marko Mäkelä
2022-07-02 8:17 ` Sean Young
2022-06-27 10:53 ` Sean Young
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=YrhSK5l0uQZT76Fi@jyty \
--to=marko.makela@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=sean@mess.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