All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: rc: nec: Treat a full NEC command frame as a fresh keypress
@ 2026-10-20  1:33 Fabio Estevam
  2026-10-20  9:08 ` Sean Young
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2026-10-20  1:33 UTC (permalink / raw)
  To: sean; +Cc: mchehab, linux-media, Fabio Estevam

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-20  9:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.