[PATCH evdev] When labeling a device as touchpad, only check for LMR buttons.

Simon Thum simon.thum at gmx.de
Tue Mar 16 10:13:43 PDT 2010


I have touchpads two in rare useage but neither has a third button. If
the kernel detects presses or advertises a middle btn for whatever
reason, why rely on it?

Aside from that,

reviewed-by: Simon Thum <simon.thum at gmx.de>

Am 16.03.2010 04:59, schrieb Peter Hutterer:
> Touchpads that have physical buttons have either LMR or BTN_TOOL_FINGER.
> Other buttons in the range evdev recognises shouldn't be taken into account
> here - they skew the detection towards touchpads and away from touchscreens.
> 
> Fedora Bug 571639
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index 3051462..b532639 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1767,6 +1767,7 @@ static int
>  EvdevProbe(InputInfoPtr pInfo)
>  {
>      int i, has_rel_axes, has_abs_axes, has_keys, num_buttons, has_scroll;
> +    int has_lmr; /* left middle right */
>      int kernel24 = 0;
>      int ignore_abs = 0, ignore_rel = 0;
>      EvdevPtr pEvdev = pInfo->private;
> @@ -1809,6 +1810,7 @@ EvdevProbe(InputInfoPtr pInfo)
>      has_abs_axes = FALSE;
>      has_keys = FALSE;
>      has_scroll = FALSE;
> +    has_lmr = FALSE;
>      num_buttons = 0;
>  
>      /* count all buttons */
> @@ -1823,6 +1825,10 @@ EvdevProbe(InputInfoPtr pInfo)
>          }
>      }
>  
> +    has_lmr = TestBit(BTN_LEFT, pEvdev->key_bitmask) ||
> +                TestBit(BTN_MIDDLE, pEvdev->key_bitmask) ||
> +                TestBit(BTN_RIGHT, pEvdev->key_bitmask);
> +
>      if (num_buttons)
>      {
>          pEvdev->flags |= EVDEV_BUTTON_EVENTS;
> @@ -1895,7 +1901,7 @@ EvdevProbe(InputInfoPtr pInfo)
>                  }
>              } else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
>                  TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
> -                if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
> +                if (has_lmr || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
>                      xf86Msg(X_INFO, "%s: Found absolute touchpad.\n", pInfo->name);
>                      pEvdev->flags |= EVDEV_TOUCHPAD;
>                      memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);



More information about the xorg-devel mailing list