[PATCH libinput 7/8] evdev: init pointer accel filters when we have rel x/y axes

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 27 14:50:07 PDT 2015


On Mon, Apr 27, 2015 at 10:01:18AM -0500, Derek Foreman wrote:
> On 27/04/15 12:52 AM, Peter Hutterer wrote:
> > Some devices provide abs x/y and rel x/y. We can't know which event the device
> > will send. The Microsoft Surface Type Cover sends relative devices, which
> 
> It probably sends events, not devices.  :)
> 
> This whole series looks correct to me (though the use of "either" to
> mean exclusive or in 6/8 caught me out momentarily)

ah, right. I changed it to "evdev: reject devices with only REL_X but no
REL_Y (or vice versa)", that's less confusing I hope :)

> 
> Reviewed-By: Derek Foreman <derekf at osg.samsung.com>

thanks, much appreciated

Cheers,
   Peter

> > then crashes libinput when we don't have an accel filter set up.
> > 
> > So instead of checking that the device doesn't have ABS_X/Y, check for the
> > device to have REL_X/Y instead.
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=1206869
> > 
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  src/evdev.c    |  4 ++--
> >  test/pointer.c | 14 +++++++++++++-
> >  2 files changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/evdev.c b/src/evdev.c
> > index db19ac8..d65b113 100644
> > --- a/src/evdev.c
> > +++ b/src/evdev.c
> > @@ -1792,8 +1792,8 @@ evdev_configure_device(struct evdev_device *device)
> >  	}
> >  
> >  	if (udev_tags & EVDEV_UDEV_TAG_MOUSE) {
> > -		if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) &&
> > -		    !libevdev_has_event_code(evdev, EV_ABS, ABS_Y) &&
> > +		if (libevdev_has_event_code(evdev, EV_REL, REL_X) &&
> > +		    libevdev_has_event_code(evdev, EV_REL, REL_Y) &&
> >
> >  		    evdev_device_init_pointer_acceleration(
> >  					device,
> >  					pointer_accel_profile_linear) == -1)
> > diff --git a/test/pointer.c b/test/pointer.c
> > index 01ea2fd..9d3dda6 100644
> > --- a/test/pointer.c
> > +++ b/test/pointer.c
> > @@ -825,6 +825,17 @@ START_TEST(pointer_accel_defaults_absolute)
> >  }
> >  END_TEST
> >  
> > +START_TEST(pointer_accel_defaults_absolute_relative)
> > +{
> > +	struct litest_device *dev = litest_current_device();
> > +	struct libinput_device *device = dev->libinput_device;
> > +
> > +	ck_assert(libinput_device_config_accel_is_available(device));
> > +	ck_assert(libinput_device_config_accel_get_default_speed(device) == 0.0);
> > +	ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
> > +}
> > +END_TEST
> > +
> >  START_TEST(pointer_accel_direction_change)
> >  {
> >  	struct litest_device *dev = litest_current_device();
> > @@ -1223,7 +1234,8 @@ int main (int argc, char **argv) {
> >  
> >  	litest_add("pointer:accel", pointer_accel_defaults, LITEST_RELATIVE, LITEST_ANY);
> >  	litest_add("pointer:accel", pointer_accel_invalid, LITEST_RELATIVE, LITEST_ANY);
> > -	litest_add("pointer:accel", pointer_accel_defaults_absolute, LITEST_ABSOLUTE, LITEST_ANY);
> > +	litest_add("pointer:accel", pointer_accel_defaults_absolute, LITEST_ABSOLUTE, LITEST_RELATIVE);
> > +	litest_add("pointer:accel", pointer_accel_defaults_absolute_relative, LITEST_ABSOLUTE|LITEST_RELATIVE, LITEST_ANY);
> >  	litest_add("pointer:accel", pointer_accel_direction_change, LITEST_RELATIVE, LITEST_ANY);
> >  
> >  	litest_add("pointer:middlebutton", middlebutton, LITEST_BUTTON, LITEST_POINTINGSTICK);
> > 
> 


More information about the wayland-devel mailing list