[arch-commits] Commit in libinput/trunk (PKGBUILD fix_crash_for_missing_ABS_X_Y.diff)

Andreas Radke andyrtr at archlinux.org
Fri Apr 10 19:23:51 UTC 2015


    Date: Friday, April 10, 2015 @ 21:23:50
  Author: andyrtr
Revision: 236149

upgpkg: libinput 0.13.0-2

apply upstream patches for FS#44416

Added:
  libinput/trunk/fix_crash_for_missing_ABS_X_Y.diff
Modified:
  libinput/trunk/PKGBUILD

------------------------------------+
 PKGBUILD                           |   14 +++-
 fix_crash_for_missing_ABS_X_Y.diff |  114 +++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-04-10 19:23:46 UTC (rev 236148)
+++ PKGBUILD	2015-04-10 19:23:50 UTC (rev 236149)
@@ -4,7 +4,7 @@
 
 pkgname=libinput
 pkgver=0.13.0
-pkgrel=1
+pkgrel=2
 pkgdesc="library that handles input devices for display servers and other applications that need to directly deal with input devices."
 arch=(i686 x86_64)
 url="http://www.freedesktop.org/wiki/Software/libinput/"
@@ -12,11 +12,19 @@
 depends=('mtdev' 'libsystemd' 'libevdev')
 makedepends=('systemd')
 options=('!libtool')
-source=(http://freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz{,.sig})
+source=(http://freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz{,.sig}
+        fix_crash_for_missing_ABS_X_Y.diff)
 sha256sums=('6cecaf7fde525f1d81474cbd495ce526d5e34c845d3e9d6f3e2565b7048cc61a'
-            'SKIP')
+            'SKIP'
+            'c1d19d53f81ba0f98911917dd3239e9e52448f6d45d961e90dadbefb707316f9')
 validpgpkeys=('3C2C43D9447D5938EF4551EBE23B7E70B467F0BF') # Peter Hutterer (Who-T) <office at who-t.net>
 
+prepare() {
+  cd $pkgname-$pkgver
+  # https://bugs.freedesktop.org/show_bug.cgi?id=89783#c15 - FS#44416
+  patch -Np1 -i ${srcdir}/fix_crash_for_missing_ABS_X_Y.diff
+}
+
 build() {
   cd $pkgname-$pkgver
   ./configure --prefix=/usr --disable-static

Added: fix_crash_for_missing_ABS_X_Y.diff
===================================================================
--- fix_crash_for_missing_ABS_X_Y.diff	                        (rev 0)
+++ fix_crash_for_missing_ABS_X_Y.diff	2015-04-10 19:23:50 UTC (rev 236149)
@@ -0,0 +1,114 @@
+From 67208c0b1acd7b6db8a853994f7e7c9be94e0178 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Wed, 8 Apr 2015 09:54:29 +1000
+Subject: evdev: fix crash for missing ABS_X/Y
+
+libevdev_set_abs_info() is a noop if the event code isn't enabled on the
+device. This leaves ABS_X/Y on NULL, causing a crash later when dereferencing
+the absinfo.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=89783
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+
+diff --git a/src/evdev.c b/src/evdev.c
+index a972b9d..115dc99 100644
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -1444,9 +1444,9 @@ evdev_fix_android_mt(struct evdev_device *device)
+ 	    !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y))
+ 		return;
+ 
+-	libevdev_set_abs_info(evdev, ABS_X,
++	libevdev_enable_event_code(evdev, EV_ABS, ABS_X,
+ 		      libevdev_get_abs_info(evdev, ABS_MT_POSITION_X));
+-	libevdev_set_abs_info(evdev, ABS_Y,
++	libevdev_enable_event_code(evdev, EV_ABS, ABS_Y,
+ 		      libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y));
+ }
+ 
+-- 
+cgit v0.10.2
+
+From e2b13e602220a906584b21d51bc5472577be4372 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Wed, 8 Apr 2015 09:54:30 +1000
+Subject: evdev: fix handling of fake MT devices without ABS_X/Y
+
+The previous code didn't handle fake MT devices without ABS_X/Y axes (like the
+Razer BlackWidow keyboard). Those devices usually start at ABS_MISC and go up
+to ABS_MAX, thus triggering the Android check.
+
+Split the condition up: if the device is not a fake MT device we check for the
+Android missing axes first and add them. Then we proceed, but now we know that
+the ABS_X axis must exist on any valid device.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=89783
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+
+diff --git a/src/evdev.c b/src/evdev.c
+index 115dc99..16ebb9c 100644
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -1431,6 +1431,18 @@ evdev_device_get_udev_tags(struct evdev_device *device,
+ 	return tags;
+ }
+ 
++/* Fake MT devices have the ABS_MT_SLOT bit set because of
++   the limited ABS_* range - they aren't MT devices, they
++   just have too many ABS_ axes */
++static inline bool
++evdev_is_fake_mt_device(struct evdev_device *device)
++{
++	struct libevdev *evdev = device->evdev;
++
++	return libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT) &&
++		libevdev_get_num_slots(evdev) == -1;
++}
++
+ static inline void
+ evdev_fix_android_mt(struct evdev_device *device)
+ {
+@@ -1441,7 +1453,8 @@ evdev_fix_android_mt(struct evdev_device *device)
+ 		return;
+ 
+ 	if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ||
+-	    !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y))
++	    !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y) ||
++	    evdev_is_fake_mt_device(device))
+ 		return;
+ 
+ 	libevdev_enable_event_code(evdev, EV_ABS, ABS_X,
+@@ -1611,10 +1624,10 @@ evdev_configure_device(struct evdev_device *device)
+ 		return -1;
+ 	}
+ 
+-	if (libevdev_has_event_code(evdev, EV_ABS, ABS_X) ||
+-	    libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X)) {
++	if (!evdev_is_fake_mt_device(device))
+ 		evdev_fix_android_mt(device);
+ 
++	if (libevdev_has_event_code(evdev, EV_ABS, ABS_X)) {
+ 		if (evdev_fix_abs_resolution(device,
+ 					     ABS_X,
+ 					     ABS_Y,
+@@ -1624,11 +1637,7 @@ evdev_configure_device(struct evdev_device *device)
+ 		device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X);
+ 		device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y);
+ 
+-		/* Fake MT devices have the ABS_MT_SLOT bit set because of
+-		   the limited ABS_* range - they aren't MT devices, they
+-		   just have too many ABS_ axes */
+-		if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT) &&
+-		    libevdev_get_num_slots(evdev) == -1) {
++		if (evdev_is_fake_mt_device(device)) {
+ 			udev_tags &= ~EVDEV_UDEV_TAG_TOUCHSCREEN;
+ 		} else if (evdev_configure_mt_device(device) == -1) {
+ 			return -1;
+-- 
+cgit v0.10.2
+
+



More information about the arch-commits mailing list