Linux Media Controller development
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: sean@mess.org
Cc: mchehab@kernel.org, linux-media@vger.kernel.org,
	Fabio Estevam <festevam@gmail.com>
Subject: [PATCH] media: rc: nec: Treat a full NEC command frame as a fresh keypress
Date: Mon, 19 Oct 2026 22:33:31 -0300	[thread overview]
Message-ID: <20261020013331.251334-1-festevam@gmail.com> (raw)

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);
 			rc_keydown(dev, rc_proto, scancode, 0);
 		} else {
 			rc_repeat(dev);
-- 
2.43.0


             reply	other threads:[~2026-10-20  1:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  1:33 Fabio Estevam [this message]
2026-10-20  9:08 ` [PATCH] media: rc: nec: Treat a full NEC command frame as a fresh keypress 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=20261020013331.251334-1-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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