public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: "Marko Mäkelä" <marko.makela@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH] media: lirc: ensure lirc device receives repeats
Date: Sat, 9 Jul 2022 10:15:21 +0100	[thread overview]
Message-ID: <YslHKajdVcsUT5W2@gofer.mess.org> (raw)
In-Reply-To: <20220708084459.7472-1-marko.makela@iki.fi>

On Fri, Jul 08, 2022 at 11:44:59AM +0300, Marko Mäkelä wrote:
> Pressing a button on a remote control unit will typically lead to
> messages being sent several times per second until the button is released.
> 
> Some remote control units indicate long key presses by sending
> special "repeat" messages, for which the protocol driver calls
> rc_repeat(). Other units repeat the same message over and over,
> which will be handled by calling rc_keydown().
> 
> The function rc_keydown() never set the LIRC "repeat" flag to distinguish
> repeated messages that were sent due to a long keypress, and messages
> sent due to repeated short keypresses. While a user-space program may
> implement special logic to distinguish long keypresses, it is much simpler
> to be able to rely on the flag.
> 
> Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement
> reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag.
> Commit b66218fddfd29f315a103db811152ab0c95fb054
> ("media: lirc: ensure lirc device receives nec repeats") fixed it up for
> rc_repeat() but not rc_keydown().

Perfect, thanks.

Sean

> 
> Signed-off-by: Marko Mäkelä <marko.makela@iki.fi>
> Co-developed-by: Sean Young <sean@mess.org>
> ---
>  drivers/media/rc/rc-main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index b90438a71c80..d914197245eb 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -786,7 +786,8 @@ static void ir_do_keydown(struct rc_dev *dev, enum rc_proto protocol,
>  			  dev->last_toggle   != toggle);
>  	struct lirc_scancode sc = {
>  		.scancode = scancode, .rc_proto = protocol,
> -		.flags = toggle ? LIRC_SCANCODE_FLAG_TOGGLE : 0,
> +		.flags = (toggle ? LIRC_SCANCODE_FLAG_TOGGLE : 0) |
> +		(!new_event ? LIRC_SCANCODE_FLAG_REPEAT : 0),
>  		.keycode = keycode
>  	};
>  
> -- 
> 2.36.1

      reply	other threads:[~2022-07-09  9:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05  8:53 [PATCH] media: rc: Always report LIRC repeat flag Marko Mäkelä
2022-07-05 17:43 ` Sean Young
2022-07-06 16:39   ` Marko Mäkelä
2022-07-07  8:57     ` Sean Young
2022-07-07 11:09       ` Marko Mäkelä
2022-07-08  7:42         ` Sean Young
2022-07-08  8:44           ` [PATCH] media: lirc: ensure lirc device receives repeats Marko Mäkelä
2022-07-09  9:15             ` 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=YslHKajdVcsUT5W2@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox