[xorg-x11-drv-evdev] Fix axis labelling and single-axis relative devices

Peter Hutterer whot at fedoraproject.org
Thu Jan 12 01:20:04 UTC 2012


commit 989a2ebe29aefdebcb35320da072cde66db0493b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jan 12 11:21:30 2012 +1000

    Fix axis labelling and single-axis relative devices

 0001-Fix-axis-labelling-for-mixed-devices.patch    |   70 ++++++++++++++++++++
 ...-REL_Y-to-exist-on-devices-with-any-relat.patch |   48 +++++++++++++
 xorg-x11-drv-evdev.spec                            |   11 +++-
 3 files changed, 128 insertions(+), 1 deletions(-)
---
diff --git a/0001-Fix-axis-labelling-for-mixed-devices.patch b/0001-Fix-axis-labelling-for-mixed-devices.patch
new file mode 100644
index 0000000..19a88f8
--- /dev/null
+++ b/0001-Fix-axis-labelling-for-mixed-devices.patch
@@ -0,0 +1,70 @@
+From be53e80fafbc1474f07737fa5817275ad79d9323 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 12 Jan 2012 11:01:22 +1000
+Subject: [PATCH] Fix axis labelling for mixed devices.
+
+If a device has both relative and absolute axes, we'd initialise the
+relative axes but label them with the absolute labels.
+Fix this by properly unsetting the flags before we initialise the axes and
+then restoring them on failure.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ src/evdev.c |   15 ++++++++++++---
+ 1 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/src/evdev.c b/src/evdev.c
+index 989a255..86a9e55 100644
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -1628,12 +1628,18 @@ static void
+ EvdevInitAbsValuators(DeviceIntPtr device, EvdevPtr pEvdev)
+ {
+     InputInfoPtr pInfo = device->public.devicePrivate;
++    int has_rel_axes = pEvdev->flags & EVDEV_RELATIVE_EVENTS;
++
++    pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
+ 
+     if (EvdevAddAbsValuatorClass(device) == Success) {
+         xf86IDrvMsg(pInfo, X_INFO,"initialized for absolute axes.\n");
+     } else {
+         xf86IDrvMsg(pInfo, X_ERROR,"failed to initialize for absolute axes.\n");
+         pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
++
++        if (has_rel_axes)
++            pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
+     }
+ }
+ 
+@@ -1643,14 +1649,14 @@ EvdevInitRelValuators(DeviceIntPtr device, EvdevPtr pEvdev)
+     InputInfoPtr pInfo = device->public.devicePrivate;
+     int has_abs_axes = pEvdev->flags & EVDEV_ABSOLUTE_EVENTS;
+ 
++    pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
++
+     if (EvdevAddRelValuatorClass(device) == Success) {
+ 
+         xf86IDrvMsg(pInfo, X_INFO,"initialized for relative axes.\n");
+ 
+-        if (has_abs_axes) {
++        if (has_abs_axes)
+             xf86IDrvMsg(pInfo, X_WARNING,"ignoring absolute axes.\n");
+-            pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
+-        }
+ 
+     } else {
+         xf86IDrvMsg(pInfo, X_ERROR,"failed to initialize for relative axes.\n");
+@@ -1658,7 +1664,10 @@ EvdevInitRelValuators(DeviceIntPtr device, EvdevPtr pEvdev)
+         pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
+ 
+         if (has_abs_axes)
++        {
++            pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
+             EvdevInitAbsValuators(device, pEvdev);
++        }
+     }
+ }
+ 
+-- 
+1.7.7.5
+
diff --git a/0001-Force-REL_X-REL_Y-to-exist-on-devices-with-any-relat.patch b/0001-Force-REL_X-REL_Y-to-exist-on-devices-with-any-relat.patch
new file mode 100644
index 0000000..3562157
--- /dev/null
+++ b/0001-Force-REL_X-REL_Y-to-exist-on-devices-with-any-relat.patch
@@ -0,0 +1,48 @@
+From dd3a14f13c21277e81c1e9c9c309a4e5b6924351 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 12 Jan 2012 11:03:30 +1000
+Subject: [PATCH] Force REL_X/REL_Y to exist on devices with any relative axes
+ (#44655)
+
+Too much in the server relies on x/y to exist and to be axes 0 and 1. Since
+smooth scrolling we initialise wheels as axes too, so if any relative axes
+exist, initialize REL_X/Y as well.
+
+For servers up to 1.11: a scrollwheel-only device now has relative axes
+where it only had buttons before.
+
+For servers 1.12 or later: the device now has x/y in addition to the scroll
+axes.
+
+X.Org Bug 44655 <http://bugs.freedesktop.org/show_bug.cgi?id=44655>
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ src/evdev.c |   11 +++++++++++
+ 1 files changed, 11 insertions(+), 0 deletions(-)
+
+diff --git a/src/evdev.c b/src/evdev.c
+index 86a9e55..77609fb 100644
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -2052,6 +2052,17 @@ EvdevProbe(InputInfoPtr pInfo)
+             pEvdev->num_buttons = num_buttons;
+         }
+ 
++        /* Some devices only have other rel axes (e.g. wheels), but we
++         * still need x/y for these. The server relies on devices having
++         * x/y as axes 0/1 and core/XI 1.x clients expect it too (#44655) */
++        if (!EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) ||
++                   !EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y))
++        {
++                xf86IDrvMsg(pInfo, X_INFO, "Forcing x/y axes to exist.\n");
++                EvdevSetBit(pEvdev->rel_bitmask, REL_X);
++                EvdevSetBit(pEvdev->rel_bitmask, REL_Y);
++        }
++
+         if (!ignore_rel)
+         {
+             xf86IDrvMsg(pInfo, X_PROBED, "Found relative axes\n");
+-- 
+1.7.7.5
+
diff --git a/xorg-x11-drv-evdev.spec b/xorg-x11-drv-evdev.spec
index 0d324b1..2a13386 100644
--- a/xorg-x11-drv-evdev.spec
+++ b/xorg-x11-drv-evdev.spec
@@ -8,7 +8,7 @@
 Summary:    Xorg X11 evdev input driver
 Name:       xorg-x11-drv-evdev
 Version:    2.6.99.901
-Release:    3%{?gitdate:.%{gitdate}git%{gitversion}}%{dist}
+Release:    4%{?gitdate:.%{gitdate}git%{gitversion}}%{dist}
 URL:        http://www.x.org
 License:    MIT
 Group:      User Interface/X Hardware Support
@@ -21,6 +21,9 @@ Source2:    commitid
 Source0:    ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
 %endif
 
+Patch01: 0001-Fix-axis-labelling-for-mixed-devices.patch
+Patch02: 0001-Force-REL_X-REL_Y-to-exist-on-devices-with-any-relat.patch
+
 ExcludeArch: s390 s390x
 
 BuildRequires: autoconf automake libtool
@@ -39,6 +42,9 @@ X.Org X11 evdev input driver.
 %prep
 %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
 
+%patch01 -p1
+%patch02 -p1
+
 %build
 autoreconf -v --install || exit 1
 %configure --disable-static --disable-silent-rules
@@ -79,6 +85,9 @@ X.Org X11 evdev input driver development files.
 
 
 %changelog
+* Thu Jan 12 2012 Peter Hutterer <peter.hutterer at redhat.com> 2.6.99.901-4.20120103git965338e9d
+- Fix axis labelling and single-axis relative devices
+
 * Wed Jan 04 2012 Peter Hutterer <peter.hutterer at redhat.com> 2.6.99.901-3.20120103git965338e9d
 - Add mtdev as dependency
 


More information about the scm-commits mailing list