Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
Peter Hutterer
1ee7b0d321 Fix crasher due to missing devnode after resume (#1536633) 2018-02-13 14:34:43 +10:00
Peter Hutterer
0af31b541e Fix crasher on first event from tablets not supported by libwacom
(#1535755)
2018-02-06 11:10:19 +10:00
Peter Hutterer
6d66d8aea1 libinput 1.9.4 2018-02-05 19:56:12 +10:00
Peter Hutterer
b95fb99969 libinput 1.9.1 2017-10-31 09:22:06 +10:00
Peter Hutterer
1bea329e8b libinput 1.9.0 2017-10-26 12:20:31 +10:00
Peter Hutterer
e49f676017 libinput 1.8.3 2017-10-04 14:14:01 +10:00
6 changed files with 138 additions and 191 deletions

4
.gitignore vendored
View file

@ -6,3 +6,7 @@
/libinput-1.8.0.tar.xz
/libinput-1.8.1.tar.xz
/libinput-1.8.2.tar.xz
/libinput-1.8.3.tar.xz
/libinput-1.9.0.tar.xz
/libinput-1.9.1.tar.xz
/libinput-1.9.4.tar.xz

View file

@ -0,0 +1,47 @@
From cb186abc17ad9e525609dc32385b0a7992e949a9 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 9 Feb 2018 19:24:15 +1000
Subject: [PATCH libinput] evdev: fail before open_restricted if the devnode
doesn't exist
https://bugzilla.redhat.com/show_bug.cgi?id=1536633
https://bugzilla.redhat.com/show_bug.cgi?id=1539046
https://bugzilla.redhat.com/show_bug.cgi?id=1539783
https://bugzilla.redhat.com/show_bug.cgi?id=1540662
https://bugs.freedesktop.org/show_bug.cgi?id=104278
Debugged-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/evdev.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/evdev.c b/src/evdev.c
index d1ca243d..63b93ec3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1917,6 +1917,11 @@ evdev_device_create(struct libinput_seat *seat,
const char *devnode = udev_device_get_devnode(udev_device);
const char *sysname = udev_device_get_sysname(udev_device);
+ if (!devnode) {
+ log_info(libinput, "%s: no device node associated\n", sysname);
+ return NULL;
+ }
+
if (udev_device_should_be_ignored(udev_device)) {
log_debug(libinput, "%s: device is ignored\n", sysname);
return NULL;
@@ -2434,6 +2439,9 @@ evdev_device_resume(struct evdev_device *device)
return -ENODEV;
devnode = udev_device_get_devnode(device->udev_device);
+ if (!devnode)
+ return -ENODEV;
+
fd = open_restricted(libinput, devnode,
O_RDWR | O_NONBLOCK | O_CLOEXEC);
--
2.14.3

View file

@ -0,0 +1,56 @@
From d26b08b93f05eba58d46ad6811e71e9da0e74201 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon, 5 Feb 2018 09:11:42 +1000
Subject: [PATCH libinput] tablet: don't set rotation on a tool if we don't
have ABS_Z
Rotation on a tool can either ABS_Z or in the case of the mouse/lens tools a
combination of ABS_TILT_X/Y. The code assumes that if the rotation on a stylus
(not mouse/lense) changes, we need to fetch it from ABS_Z. This happens on the
very first event from the tablet, proximity in invalidates all axes so we can
send the current state to the caller.
On libwacom-recognized tablets we never set the rotation bit on the stylus, so
that's all fine. On tablets without libwacom support, the stylus may have a
rotation bit copied because we have it set thanks to mouse+tilt on the tablet.
When that first event is handled, we try to access ABS_Z. On tablets without
ABS_Z like Aipteks, we go boom.
Fix this by checking for ABS_Z during tablet init, if we don't have that axis
then never set the rotation bit on the tool. That's the only axis where we
need this, all other axes have a single cause only and thus the tablet bits
are accurate anyway.
https://bugs.freedesktop.org/show_bug.cgi?id=104939
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/evdev-tablet.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 2f6b64da..771e7775 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -933,7 +933,17 @@ tool_set_bits(const struct tablet_dispatch *tablet,
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_X);
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y);
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER);
- copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
+
+ /* Rotation is special, it can be either ABS_Z or
+ * BTN_TOOL_MOUSE+ABS_TILT_X/Y. Aiptek tablets have
+ * mouse+tilt (and thus rotation), but they do not have
+ * ABS_Z. So let's not copy the axis bit if we don't have
+ * ABS_Z, otherwise we try to get the value from it later on
+ * proximity in and go boom because the absinfo isn't there.
+ */
+ if (libevdev_has_event_code(tablet->device->evdev, EV_ABS,
+ ABS_Z))
+ copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
break;
case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
case LIBINPUT_TABLET_TOOL_TYPE_LENS:
--
2.14.3

View file

@ -1,186 +0,0 @@
From 03f13ce6e854b3ff5d4b8971405a97afd66eef8e Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 5 Sep 2017 14:38:53 +1000
Subject: [PATCH libinput] touchpad: don't resume a disabled touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/evdev-mt-touchpad.c | 44 ++++++++++++++++++----------
test/test-lid.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+), 15 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 5b8fb1ec..c0a78255 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1426,6 +1426,31 @@ tp_resume(struct tp_dispatch *tp, struct evdev_device *device)
}
}
+#define NO_EXCLUDED_DEVICE NULL
+static void
+tp_resume_conditional(struct tp_dispatch *tp,
+ struct evdev_device *device,
+ struct evdev_device *excluded_device)
+{
+ if (tp->sendevents.current_mode == LIBINPUT_CONFIG_SEND_EVENTS_DISABLED)
+ return;
+
+ if (tp->sendevents.current_mode ==
+ LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) {
+ struct libinput_device *dev;
+
+ list_for_each(dev, &device->base.seat->devices_list, link) {
+ struct evdev_device *d = evdev_device(dev);
+ if (d != excluded_device &&
+ (d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) {
+ return;
+ }
+ }
+ }
+
+ tp_resume(tp, device);
+}
+
static void
tp_trackpoint_timeout(uint64_t now, void *data)
{
@@ -1667,7 +1692,7 @@ tp_lid_switch_event(uint64_t time, struct libinput_event *event, void *data)
swev = libinput_event_get_switch_event(event);
switch (libinput_event_switch_get_switch_state(swev)) {
case LIBINPUT_SWITCH_STATE_OFF:
- tp_resume(tp, tp->device);
+ tp_resume_conditional(tp, tp->device, NO_EXCLUDED_DEVICE);
evdev_log_debug(tp->device, "lid: resume touchpad\n");
break;
case LIBINPUT_SWITCH_STATE_ON:
@@ -1722,7 +1747,6 @@ tp_interface_device_removed(struct evdev_device *device,
struct evdev_device *removed_device)
{
struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch;
- struct libinput_device *dev;
if (removed_device == tp->buttons.trackpoint) {
/* Clear any pending releases for the trackpoint */
@@ -1749,19 +1773,9 @@ tp_interface_device_removed(struct evdev_device *device,
tp->lid_switch.lid_switch = NULL;
}
- if (tp->sendevents.current_mode !=
- LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
- return;
-
- list_for_each(dev, &device->base.seat->devices_list, link) {
- struct evdev_device *d = evdev_device(dev);
- if (d != removed_device &&
- (d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) {
- return;
- }
- }
-
- tp_resume(tp, device);
+ /* removed_device is still in the device list at this point, so we
+ * need to exclude it from the tp_resume_conditional */
+ tp_resume_conditional(tp, device, removed_device);
}
static inline void
diff --git a/test/test-lid.c b/test/test-lid.c
index 4bf4c059..7e42f53d 100644
--- a/test/test-lid.c
+++ b/test/test-lid.c
@@ -342,6 +342,81 @@ START_TEST(lid_disable_touchpad_already_open)
}
END_TEST
+START_TEST(lid_dont_resume_disabled_touchpad)
+{
+ struct litest_device *sw = litest_current_device();
+ struct litest_device *touchpad;
+ struct libinput *li = sw->libinput;
+
+ touchpad = lid_init_paired_touchpad(li);
+ litest_disable_tap(touchpad->libinput_device);
+ libinput_device_config_send_events_set_mode(touchpad->libinput_device,
+ LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
+ litest_drain_events(li);
+
+ /* switch is on - no events */
+ litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
+
+ litest_touch_down(touchpad, 0, 50, 50);
+ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
+ litest_touch_up(touchpad, 0);
+ litest_assert_empty_queue(li);
+
+ /* switch is off - motion events */
+ litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
+
+ litest_touch_down(touchpad, 0, 50, 50);
+ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
+ litest_touch_up(touchpad, 0);
+ litest_assert_empty_queue(li);
+
+ litest_delete_device(touchpad);
+}
+END_TEST
+
+START_TEST(lid_dont_resume_disabled_touchpad_external_mouse)
+{
+ struct litest_device *sw = litest_current_device();
+ struct litest_device *touchpad, *mouse;
+ struct libinput *li = sw->libinput;
+
+ touchpad = lid_init_paired_touchpad(li);
+ mouse = litest_add_device(li, LITEST_MOUSE);
+ litest_disable_tap(touchpad->libinput_device);
+ libinput_device_config_send_events_set_mode(touchpad->libinput_device,
+ LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
+ litest_drain_events(li);
+
+ litest_touch_down(touchpad, 0, 50, 50);
+ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
+ litest_touch_up(touchpad, 0);
+ litest_assert_empty_queue(li);
+
+ /* switch is on - no events */
+ litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
+
+ litest_touch_down(touchpad, 0, 50, 50);
+ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
+ litest_touch_up(touchpad, 0);
+ litest_assert_empty_queue(li);
+
+ /* switch is off - motion events */
+ litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
+
+ litest_touch_down(touchpad, 0, 50, 50);
+ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
+ litest_touch_up(touchpad, 0);
+ litest_assert_empty_queue(li);
+
+ litest_delete_device(touchpad);
+ litest_delete_device(mouse);
+}
+END_TEST
+
START_TEST(lid_open_on_key)
{
struct litest_device *sw = litest_current_device();
@@ -568,6 +643,9 @@ litest_setup_tests_lid(void)
litest_add("lid:disable_touchpad", lid_disable_touchpad_edge_scroll_interrupt, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:disable_touchpad", lid_disable_touchpad_already_open, LITEST_SWITCH, LITEST_ANY);
+ litest_add("switch:touchpad", lid_dont_resume_disabled_touchpad, LITEST_SWITCH, LITEST_ANY);
+ litest_add("switch:touchpad", lid_dont_resume_disabled_touchpad_external_mouse, LITEST_SWITCH, LITEST_ANY);
+
litest_add("lid:keyboard", lid_open_on_key, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:keyboard", lid_open_on_key_touchpad_enabled, LITEST_SWITCH, LITEST_ANY);
--
2.13.5

View file

@ -4,8 +4,8 @@
%global gitversion 58abea394
Name: libinput
Version: 1.8.2
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Version: 1.9.4
Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Summary: Input device library
License: MIT
@ -18,7 +18,8 @@ Source2: commitid
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
%endif
Patch02: 0001-touchpad-don-t-resume-a-disabled-touchpad.patch
Patch01: 0001-tablet-don-t-set-rotation-on-a-tool-if-we-don-t-have.patch
Patch02: 0001-evdev-fail-before-open_restricted-if-the-devnode-doe.patch
BuildRequires: git-core
BuildRequires: gcc
@ -90,9 +91,16 @@ git am -p1 %{patches} < /dev/null
%{_libexecdir}/libinput/libinput-list-devices
%{_libexecdir}/libinput/libinput-measure
%{_libexecdir}/libinput/libinput-measure-touchpad-tap
%{_libexecdir}/libinput/libinput-measure-touchpad-pressure
%{_libexecdir}/libinput/libinput-measure-touch-size
%{_libexecdir}/libinput/libinput-measure-trackpoint-range
%{_mandir}/man1/libinput.1*
%{_mandir}/man1/libinput-measure.1*
%{_mandir}/man1/libinput-measure-touchpad-tap.1*
%{_mandir}/man1/libinput-measure-touch-size.1*
%{_mandir}/man1/libinput-measure-touchpad-pressure.1*
%{_mandir}/man1/libinput-measure-trackpoint-range.1*
%{_mandir}/man1/libinput-list-devices.1*
%{_mandir}/man1/libinput-debug-events.1*
%{_bindir}/libinput-list-devices
@ -103,8 +111,26 @@ git am -p1 %{patches} < /dev/null
%{_libdir}/libinput.so
%{_libdir}/pkgconfig/libinput.pc
%changelog
* Tue Feb 13 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.9.4-3
- Fix crasher due to missing devnode after resume (#1536633)
* Mon Feb 05 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.9.4-2
- Fix crasher on first event from tablets not supported by libwacom
(#1535755)
* Mon Feb 05 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.9.4-1
- libinput 1.9.4
* Tue Oct 31 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.9.1-1
- libinput 1.9.1
* Thu Oct 26 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.9.0-1
- libinput 1.9.0
* Wed Oct 04 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.8.3-1
- libinput 1.8.3
* Thu Sep 07 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.8.2-1
- libinput 1.8.2

View file

@ -1 +1 @@
SHA512 (libinput-1.8.2.tar.xz) = 555a7680cc8aaf62c5370a865f3aff0a933d42d94a3d8861c072666b02c9e1be45ea39de9a749a9575cdfb613b6150e412e18559d94d4919f21ca4680a3c76a7
SHA512 (libinput-1.9.4.tar.xz) = 302f9497ea9ffb2163c643e9ca2f0a773ea141f6fe0a3aa3d8e86eb11a5d11e75d858b1e679ebfd3f913c645beac059cfd356b37c4ea17a8853068f79a740a4b