From 2a328ce333abeab2cf8c525f29765fcbc8851de5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 26 Feb 2015 17:28:39 +1000 Subject: [PATCH] Don't detect multimedia keyboards as joysticks (#1194469) --- ...reful-about-what-we-consider-a-joyst.patch | 74 +++++++++++++++++++ libinput.spec | 7 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 0001-evdev-Be-more-careful-about-what-we-consider-a-joyst.patch diff --git a/0001-evdev-Be-more-careful-about-what-we-consider-a-joyst.patch b/0001-evdev-Be-more-careful-about-what-we-consider-a-joyst.patch new file mode 100644 index 0000000..e9a9dd0 --- /dev/null +++ b/0001-evdev-Be-more-careful-about-what-we-consider-a-joyst.patch @@ -0,0 +1,74 @@ +From 5f848ea35757dde7847d11464a7fec106a4a30f9 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 21 Jan 2015 12:04:48 +0100 +Subject: [PATCH libinput] evdev: Be more careful about what we consider a + joystick + +After switching my main workstation over to using xf86-input-libinput, I +noticed that the multi-media keys like play/pause on my keyboard no longer +worked. + +It turns out that the second hid interface on my keyboard which has the +multimedia-keys, also declares having: BTN_BASE6 and BTN_MODE which both +fell into the range we were using to test for something being a joystick. + +The commit makes our joystick test mode strict, restoring functionality +of the multi-media keys on the keyboard in question. + +Signed-off-by: Hans de Goede +Reviewed-by: Peter Hutterer +Signed-off-by: Peter Hutterer +(cherry picked from commit 0afd0b792fb9c244442ac4532ceeaa9565dd1928) +--- + src/evdev.c | 25 ++++++++++++++++--------- + 1 file changed, 16 insertions(+), 9 deletions(-) + +diff --git a/src/evdev.c b/src/evdev.c +index dce035a..7ea7cd6 100644 +--- a/src/evdev.c ++++ b/src/evdev.c +@@ -1283,7 +1283,7 @@ evdev_configure_device(struct evdev_device *device) + struct libevdev *evdev = device->evdev; + const struct input_absinfo *absinfo; + int has_abs, has_rel, has_mt; +- int has_button, has_keyboard, has_touch; ++ int has_button, has_keyboard, has_touch, has_joystick_button; + struct mt_slot *slots; + int num_slots; + int active_slot; +@@ -1295,17 +1295,24 @@ evdev_configure_device(struct evdev_device *device) + has_abs = 0; + has_mt = 0; + has_button = 0; ++ has_joystick_button = 0; + has_keyboard = 0; + has_touch = 0; + +- for (i = BTN_JOYSTICK; i < BTN_DIGI; i++) { +- if (libevdev_has_event_code(evdev, EV_KEY, i)) { +- log_info(libinput, +- "input device '%s', %s is a joystick, ignoring\n", +- device->devname, devnode); +- return -1; +- } +- } ++ for (i = BTN_JOYSTICK; i <= BTN_PINKIE; i++) ++ if (libevdev_has_event_code(evdev, EV_KEY, i)) ++ has_joystick_button = 1; ++ ++ for (i = BTN_GAMEPAD; i <= BTN_TR2; i++) ++ if (libevdev_has_event_code(evdev, EV_KEY, i)) ++ has_joystick_button = 1; ++ ++ if (has_joystick_button) { ++ log_info(libinput, ++ "input device '%s', %s is a joystick, ignoring\n", ++ device->devname, devnode); ++ return -1; ++ } + + if (libevdev_has_event_type(evdev, EV_ABS)) { + +-- +2.1.0 + diff --git a/libinput.spec b/libinput.spec index 8b58d10..8583870 100644 --- a/libinput.spec +++ b/libinput.spec @@ -3,7 +3,7 @@ Name: libinput Version: 0.7.0 -Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -16,6 +16,8 @@ Source2: commitid Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz %endif +Patch01: 0001-evdev-Be-more-careful-about-what-we-consider-a-joyst.patch + BuildRequires: git BuildRequires: autoconf automake libtool pkgconfig BuildRequires: libevdev-devel @@ -80,6 +82,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete %changelog +* Thu Feb 26 2015 Peter Hutterer 0.7.0-3.20141211git58abea394 +- Don't detect multimedia keyboards as joysticks (#1194469) + * Thu Dec 11 2014 Peter Hutterer 0.7.0-2.20141211git58abea394 - git snapshot, fixes a crasher and fd confusion after suspending a device