Fix crash with the MS Surface Type Cover (#1206869)
This commit is contained in:
parent
1bd3c48c98
commit
c2dbcdf9a2
@ -0,0 +1,71 @@
|
||||
From 5703a748e1fdaab5cc76705fd4518bc33c65e207 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Fri, 24 Apr 2015 14:59:18 +1000
|
||||
Subject: [PATCH libinput] evdev: init pointer accel filters when we have rel
|
||||
x/y axes
|
||||
|
||||
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
|
||||
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@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 8ca7a76..e16747b 100644
|
||||
--- a/src/evdev.c
|
||||
+++ b/src/evdev.c
|
||||
@@ -1791,8 +1791,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);
|
||||
--
|
||||
2.3.5
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
Name: libinput
|
||||
Version: 0.14.1
|
||||
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
|
||||
Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
|
||||
Summary: Input device library
|
||||
|
||||
License: MIT
|
||||
@ -18,6 +18,8 @@ Source2: commitid
|
||||
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
|
||||
%endif
|
||||
|
||||
Patch01: 0001-evdev-init-pointer-accel-filters-when-we-have-rel-x-.patch
|
||||
|
||||
BuildRequires: git
|
||||
BuildRequires: autoconf automake libtool pkgconfig
|
||||
BuildRequires: libevdev-devel
|
||||
@ -86,6 +88,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 24 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.14.1-2
|
||||
- Fix crash with the MS Surface Type Cover (#1206869)
|
||||
|
||||
* Wed Apr 22 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.14.1-1
|
||||
- libinput 0.14.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user