[PATCH evdev] Only force REL_X/Y if no ABS_X/Y exists

Chase Douglas chase.douglas at canonical.com
Wed Jan 25 10:48:27 PST 2012


On 01/25/2012 07:26 AM, Peter Hutterer wrote:
> 5c5b2c8db851df7921cedd888222a6630a007fd8 added forced x/y axes if a device
> has any axes of the same mode. This was too broad a brush, some devices have
> a relative wheel but absolute x/y axes and would now get misdetected as
> purely relative device.
> 
> Only force relative axes if a device no rel x/y _and_ no abs x/y.
> 
> Reproducible: virtual machine with QEMU USB Tablet will stop working
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev.c |   18 ++++++++++--------
>  1 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index 32fe38b..a6f9a59 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -2125,6 +2125,13 @@ EvdevProbe(InputInfoPtr pInfo)
>          }
>      }
>  
> +    for (i = 0; i < ABS_MAX; i++) {
> +        if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
> +            has_abs_axes = TRUE;
> +            break;
> +        }
> +    }
> +
>      if (has_rel_axes) {
>          if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL) ||
>              EvdevBitIsSet(pEvdev->rel_bitmask, REL_HWHEEL) ||
> @@ -2146,7 +2153,9 @@ EvdevProbe(InputInfoPtr pInfo)
>              if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) &&
>                  EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) {
>                  xf86IDrvMsg(pInfo, X_PROBED, "Found x and y relative axes\n");
> -            } else
> +            } else if (!has_abs_axes ||
> +                       !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) ||
> +                       !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y))

!has_abs_axes implies !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) and
!EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y). If I'm parsing the logic
right, we don't need the check for !has_abs_axes. There is no case in
which !has_abs_axes can be true but the ABS_X and ABS_Y are not present.

-- Chase


More information about the xorg-devel mailing list