From 8b0136e75428262b135adde678b7a3aacd08e7ef Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Jan 08 2013 05:08:57 +0000 Subject: Ignore joysticks with MT axes --- diff --git a/0001-Force-a-button-if-MT-axes-are-present-and-it-is-not-.patch b/0001-Force-a-button-if-MT-axes-are-present-and-it-is-not-.patch new file mode 100644 index 0000000..1d70576 --- /dev/null +++ b/0001-Force-a-button-if-MT-axes-are-present-and-it-is-not-.patch @@ -0,0 +1,63 @@ +From 454194f4b530af5d7f92a3b28c28495b4faac547 Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Tue, 8 Jan 2013 15:04:07 +1000 +Subject: [PATCH evdev] Force a button if MT axes are present and it is not a + gamepad + +We expect at least BTN_TOUCH for anything with MT axes, but devices that +don't have that need a button class regardless. Some gamepads define +MT axes but no buttons, causing a bug in the server when they post a +TouchBegin. + +[ 97436.293] (EE) BUG: triggered 'if (!b || !v)' +[ 97436.293] (EE) BUG: exevents.c:929 in UpdateDeviceState() + +So, ignore it, if it is a joystick (e. g. if it have BTN_JOYSTICK defined). +Otherwise, fake a button. + +This patch basically merges two patches written by Peter Hutterer +. + +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Peter Hutterer +--- + src/evdev.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/evdev.c b/src/evdev.c +index 7b355d7..5667dc1 100644 +--- a/src/evdev.c ++++ b/src/evdev.c +@@ -2160,8 +2160,20 @@ EvdevProbe(InputInfoPtr pInfo) + xf86IDrvMsg(pInfo, X_PROBED, "Found absolute axes\n"); + pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS; + +- if (has_mt) ++ if (has_mt) { + xf86IDrvMsg(pInfo, X_PROBED, "Found absolute multitouch axes\n"); ++ if (num_buttons == 0) { ++ if (EvdevBitIsSet(pEvdev->key_bitmask, BTN_JOYSTICK)) { ++ xf86IDrvMsg(pInfo, X_INFO, "Device is a Joystick with MT without buttons. Ignoring it.\n"); ++ goto out; ++ } else { ++ xf86IDrvMsg(pInfo, X_INFO, "No buttons found, faking one.\n"); ++ num_buttons = 1; ++ pEvdev->num_buttons = num_buttons; ++ pEvdev->flags |= EVDEV_BUTTON_EVENTS; ++ } ++ } ++ } + + if ((EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) && + EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y))) { +@@ -2276,6 +2288,7 @@ EvdevProbe(InputInfoPtr pInfo) + pEvdev->flags |= EVDEV_RELATIVE_EVENTS; + } + ++out: + if (rc) + xf86IDrvMsg(pInfo, X_WARNING, "Don't know how to use device\n"); + +-- +1.8.1 + diff --git a/xorg-x11-drv-evdev.spec b/xorg-x11-drv-evdev.spec index 0d0774d..cf23d85 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.7.3 -Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} URL: http://www.x.org License: MIT Group: User Interface/X Hardware Support @@ -23,6 +23,8 @@ Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2 # Bug 805902 - Scrollwheels on tablets are broken Patch02: 0001-Allow-relative-scroll-valuators-on-absolute-devices.patch +# fdo 58967 - Device with MT axes but no buttons triggers BUG macro +Patch03: 0001-Force-a-button-if-MT-axes-are-present-and-it-is-not-.patch ExcludeArch: s390 s390x %{?rhel:ppc ppc64} @@ -42,6 +44,7 @@ X.Org X11 evdev input driver. %prep %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}} %patch02 -p1 -b .relscroll +%patch03 -p1 %build autoreconf --force -v --install || exit 1 @@ -83,6 +86,9 @@ X.Org X11 evdev input driver development files. %changelog +* Tue Jan 08 2013 Peter Hutterer 2.7.3-3 +- Ignore joysticks with MT axes + * Wed Oct 31 2012 Peter Hutterer 2.7.3-2 - Fix %{?dist} tag