public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Hutterer <peter.hutterer@who-t.net>
To: Anssi Hannula <anssi.hannula@iki.fi>
Cc: linux-media@vger.kernel.org,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	xorg-devel@lists.freedesktop.org
Subject: Re: IR remote control autorepeat / evdev
Date: Tue, 10 May 2011 14:11:07 +1000	[thread overview]
Message-ID: <20110510041107.GA32552@barra.redhat.com> (raw)
In-Reply-To: <4DC61E28.4090301@iki.fi>

On Sun, May 08, 2011 at 07:38:00AM +0300, Anssi Hannula wrote:
> Hi all!
> 
> Most IR/RF remotes differ from normal keyboards in that they don't
> provide release events. They do provide native repeat events, though.
> 
> Currently the Linux kernel RC/input subsystems provide a simulated
> autorepeat for remote controls (default delay 500ms, period 33ms), and
> X.org server ignores these events and generates its own autorepeat for them.
>
> The kernel RC subsystem provides a simulated release event when 250ms
> has passed since the last native event (repeat or non-repeat) was
> received from the device.
> 
> This is problematic, since it causes lots of extra repeat events to be
> always sent (for up to 250ms) after the user has released the remote
> control button, which makes the remote quite uncomfortable to use.

I got a bit confused reading this description. Does this mean that remotes
usually send:
    key press - repeat - repeat - ... - repeat - <silence>
where the silence indicates that the key has been released? Which the kernel
after 250ms translates into a release event.
And the kernel discards the repeats and generates it's own on 500/33?
Do I get this right so far?

If so, I'm not sure how to avoid the 250ms delay since we have no indication
from the hardware when the silence will stop, right?

Note that the repeat delay and ratio are configurable per-device using XKB,
so you could set up the 500/33 in X too.

Cheers,
  Peter

> Now, IMO something should be done to fix this. But what exactly?
> 
> Here are two ideas that would remove these ghost repeats:
> 
> 1. Do not provide any repeat/release simulation in the kernel for RC
> devices (by default?), just provide both keydown and immediate release
> events for every native keypress or repeat received from the device.
> + Very simple to implement
> - We lose the ability to track repeats, i.e. if a new event was a repeat
>   or a new keypress; "holding down" a key becomes impossible
> 
> or
> 2. Replace kernel autorepeat simulation by passing through the native
> repeat events (probably filtering them according to REP_DELAY and
> REP_PERIOD), and have a device property bit (fetchable via EVIOCGPROP)
> indicating that the keyrelease is simulated, and have the X server use
> the native repeats instead of softrepeats for such a device.
> + The userspace correctly gets repeat events tagged as repeats and
>   release events when appropriate (albeit a little late)
> - Adds complexity. Also, while the kernel part is quite easy to
>   implement, I'm not sure if the X server part is.
> 
> or
> 3. Same as 1., but indicate the repeatness of an event with a new
>    additional special event before EV_SYN (sync event).
> + Simple to implement
> - Quite hacky, and userspace still can't guess from initial
>   keypress/release if the key is still pressed down or not.
> 
> 4. Same as 1., but have a new EV_RC with RC_KEYDOWN and RC_KEYUP events,
>    with RC_KEYDOWN sent when a key is pressed down a first time along
>    with the normal EV_KEY event, and RC_KEYUP sent when the key is
>    surely released (e.g. 250ms without native repeat events or another
>    key got pressed, i.e. like the simulated keyup now).
> + Simple to implement, works as expected with most userspace apps with
>   no changes to them; and if an app wants to know the repeatness of an
>   event or held-down-ness of a key, it can do that.
> - Repeatness of the event is hidden behind a new API.
> 
> What do you think? Or any other ideas?
> 
> 2 and 4 seem nicest to me.
> (I don't know how feasible 2 would be on X server side, though)
> 
> -- 
> Anssi Hannula
> _______________________________________________
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 

  reply	other threads:[~2011-05-10  4:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08  4:38 IR remote control autorepeat / evdev Anssi Hannula
2011-05-10  4:11 ` Peter Hutterer [this message]
2011-05-10  5:14   ` Anssi Hannula
2011-05-10  5:30     ` Peter Hutterer
2011-05-10 13:43       ` Anssi Hannula
2011-05-11  4:46         ` Mauro Carvalho Chehab
2011-05-11 16:33           ` Anssi Hannula
2011-05-11 16:51             ` Mauro Carvalho Chehab
2011-05-11 17:59               ` Anssi Hannula
2011-05-11 20:53                 ` Dmitry Torokhov
2011-05-12  0:17                   ` Anssi Hannula
2011-05-12  0:55                     ` Mauro Carvalho Chehab
2011-05-11 23:52                 ` Mauro Carvalho Chehab
2011-05-12  0:37                   ` Anssi Hannula
2011-05-12  1:10                     ` Mauro Carvalho Chehab
2011-05-12  1:36                       ` Mauro Carvalho Chehab
2011-05-12  3:48                         ` Jarod Wilson
2011-05-12  6:05                         ` Peter Hutterer
2011-05-12 13:24                           ` Jarod Wilson
2011-05-13  7:51                           ` Mauro Carvalho Chehab
2011-05-16  1:35                             ` Peter Hutterer
2011-05-12 23:48                         ` Anssi Hannula
2011-05-13 22:39                           ` Mauro Carvalho Chehab
2011-05-13 23:07                             ` Anssi Hannula
2011-05-15  3:41                               ` Mauro Carvalho Chehab
2011-05-23 21:36                                 ` Anssi Hannula

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=20110510041107.GA32552@barra.redhat.com \
    --to=peter.hutterer@who-t.net \
    --cc=anssi.hannula@iki.fi \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=xorg-devel@lists.freedesktop.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