[PATCH evdev] add button debouncing

Daniel Stone daniel at fooishbar.org
Thu Aug 23 01:58:26 PDT 2012


Hi,

On 23 August 2012 08:40, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> On Mon, Aug 13, 2012 at 05:47:12PM -0400, Matt Whitlock wrote:
>> This patch adds one configuration option, "DebounceDelay", and one XInput
>> property, "Evdev Debounce Delay". They refer to the amount of time to wait
>> after receiving a mouse button release event from the kernel before posting
>> the event to the X server. If a mouse button pressed event is received before
>> the delay expires, then the release/press pair is forgotten. This allows to
>> deal with mice whose button switches are worn out or dirty. Each mouse button
>> is debounced independently.
>
> Just reading the description, I think this is the wrong way round. Why not
> let the first event through unconditionally and then discard the second one
> if it arrives within the time frame. This wouldn't require a timer, instead
> you could note the time the last event arrived and then act on that.

Huh? The problem is when you have a press-pause-release pattern which
is actually sent as press-release-press-release-press-release.  So,
you want to suppress the inner release/press.

> Having said that, I'm really hesitant on this feature. The reason you
> stated is "mice whose button switches are worn out or dirty". Is the cost of
> replacing (or cleaning) said device not a lot less than writing the code and
> maintaining it? How many devices are actually affected by this?

It's not just that, it's also wireless mice with flaky connections and
a few other cases.  Admittedly the hardware is definitely getting
better and this is less of a problem than it used to be, but I think
it's worth pushing anyway.

Cheers,
Daniel


More information about the xorg-devel mailing list