From: Sean Young <sean@mess.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: mchehab@kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] media: rc: nec: Treat a full NEC command frame as a fresh keypress
Date: Tue, 20 Oct 2026 10:08:20 +0100 [thread overview]
Message-ID: <atcvhK5h_Do5SJgz@extorris.mess.org> (raw)
In-Reply-To: <20261020013331.251334-1-festevam@gmail.com>
On Mon, Oct 19, 2026 at 10:33:31PM -0300, Fabio Estevam wrote:
> NEC sends one full command frame per keypress, followed by short repeat
> frames while the button remains held. The decoder already distinguishes
> these cases and reports them through rc_keydown() and rc_repeat().
>
> Without a toggle bit, rc-core treats a second command with the same
> scancode inside the key-up timeout as part of the existing press. The
> second tap therefore loses its key-down event. Call rc_keyup() before
> reporting each full command frame so rc-core recognizes a fresh press.
> Repeat frames still use rc_repeat() and remain unchanged.
>
> Measured on a Ruwido Z3 over a 1.2 s hold: one command frame followed
> by 11 repeat frames. Command and repeat header spaces were 4.5 ms and
> 2.2 ms, respectively, with no overlap.
>
> NEC remotes that repeat full command frames while held will instead
> produce press/release trains.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> drivers/media/rc/ir-nec-decoder.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
> index 37b99432ad0d..4357413763ca 100644
> --- a/drivers/media/rc/ir-nec-decoder.c
> +++ b/drivers/media/rc/ir-nec-decoder.c
> @@ -153,6 +153,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
> if (data->is_nec_x)
> data->necx_repeat = true;
>
> + rc_keyup(dev);
I'm sorry, this is simply not correct. There are nec remotes which send the
full nec code (so no repeat) at least times when you press any button. As
long as the button is pressed, the code is repeated.
If you want to distinct keypresses for when a button is held down, use the
input autorepeat feature. You can adjust it with ir-keytable -D and
ir-keytable -P.
Thanks,
Sean
> rc_keydown(dev, rc_proto, scancode, 0);
> } else {
> rc_repeat(dev);
> --
> 2.43.0
>
prev parent reply other threads:[~2026-10-20 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 1:33 [PATCH] media: rc: nec: Treat a full NEC command frame as a fresh keypress Fabio Estevam
2026-10-20 9:08 ` Sean Young [this message]
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=atcvhK5h_Do5SJgz@extorris.mess.org \
--to=sean@mess.org \
--cc=festevam@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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