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

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 25 17:37:02 PST 2012


On Wed, Jan 25, 2012 at 07:48:27PM +0100, Chase Douglas wrote:
> 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.

yeah, you're right, it's a bit superfluous and was mainly intended to skip
the bit-checks if we don't have axes at all. but given that it's just a bit
check, this isn't a performance issue here, so I'll just remove the
!has_abs_axes part.

Cheers,
  Peter


More information about the xorg-devel mailing list