Fix complaints about double tracking IDs on the MagicMouse (#1361325)

This commit is contained in:
Peter Hutterer 2016-08-17 11:00:48 +10:00
parent 5b642a0cad
commit 9b039b84f0
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From b313c87ab188c471b356b1c3a170bec5571aee68 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 17 Aug 2016 10:48:43 +1000
Subject: [PATCH libevdev] Don't bother sanitizing disabled event codes
Filter them immediately instead of passing them on and relying on the actual
event handling code to filter them.
Reproducer: if EV_ABS is disabled on an Apple MagicMouse we still get events
passed into sanitize_event(). But the code handling EV_ABS events doesn't
update the state, so we end up complaining about double tracking IDs, even
though that is not actually correct.
https://bugzilla.redhat.com/show_bug.cgi?id=1361325
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
libevdev/libevdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 48b49b1..43a095c 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -979,6 +979,9 @@ sanitize_event(const struct libevdev *dev,
struct input_event *ev,
enum SyncState sync_state)
{
+ if (!libevdev_has_event_code(dev, ev->type, ev->code))
+ return EVENT_FILTER_DISCARD;
+
if (unlikely(dev->num_slots > -1 &&
libevdev_event_is_code(ev, EV_ABS, ABS_MT_SLOT) &&
(ev->value < 0 || ev->value >= dev->num_slots))) {
--
2.7.4

View File

@ -1,6 +1,6 @@
Name: libevdev
Version: 1.5.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Kernel Evdev Device Wrapper Library
Group: System Environment/Libraries
@ -8,6 +8,8 @@ License: MIT
URL: http://www.freedesktop.org/wiki/Software/libevdev
Source0: http://www.freedesktop.org/software/%{name}/%{name}-%{version}.tar.xz
Patch01: 0001-Don-t-bother-sanitizing-disabled-event-codes.patch
BuildRequires: automake libtool
BuildRequires: python
@ -31,6 +33,7 @@ Utilities to handle and/or debug evdev devices.
%prep
%setup -q -n %{name}-%{version}
%patch01 -p1
%build
autoreconf --force -v --install || exit 1
@ -65,6 +68,9 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_bindir}/libevdev-tweak-device
%changelog
* Wed Aug 17 2016 Peter Hutterer <peter.hutterer@redhat.com> 1.5.2-2
- Fix complaints about double tracking IDs on the MagicMouse (#1361325)
* Wed Jun 15 2016 Peter Hutterer <peter.hutterer@redhat.com> 1.5.2-1
- libevdev 1.5.2