summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-05-05 12:48:35 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-05 12:50:04 +1000
commit9d1fdb0c6deacf11bfa2e32a56ff2ce0df2291c1 (patch)
treed5ed45110f85a7b84c48dab36444a72bdc9cc871
parent87b04a0cb222c6b255f247c7b76d1b6424733964 (diff)
touchpad: remove the lid switch listener on device_removed
Sequence triggered by the xorg driver, but basically: if the touchpad is destroyed before the lid switch, the event listener wasn't removed and an assertion was triggered. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev-mt-touchpad.c6
-rw-r--r--test/test-lid.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 8140c44..e0757e1 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1768,6 +1768,12 @@ tp_interface_device_removed(struct evdev_device *device,
tp->dwt.keyboard = NULL;
}
+ if (removed_device == tp->lid_switch.lid_switch) {
+ libinput_device_remove_event_listener(
+ &tp->lid_switch.lid_switch_listener);
+ tp->lid_switch.lid_switch = NULL;
+ }
+
if (tp->sendevents.current_mode !=
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
return;
diff --git a/test/test-lid.c b/test/test-lid.c
index a5f439a..6b2fa3c 100644
--- a/test/test-lid.c
+++ b/test/test-lid.c
@@ -407,6 +407,30 @@ START_TEST(lid_open_on_key_touchpad_enabled)
}
END_TEST
+START_TEST(lid_suspend_with_touchpad)
+{
+ struct libinput *li;
+ struct litest_device *touchpad, *sw;
+
+ li = litest_create_context();
+
+ sw = litest_add_device(li, LITEST_LID_SWITCH);
+ litest_drain_events(li);
+
+ touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+ litest_delete_device(touchpad);
+ touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+ litest_drain_events(li);
+
+ litest_delete_device(sw);
+ litest_drain_events(li);
+ litest_delete_device(touchpad);
+ litest_drain_events(li);
+
+ libinput_unref(li);
+}
+END_TEST
+
START_TEST(lid_update_hw_on_key)
{
struct litest_device *sw = litest_current_device();
@@ -469,5 +493,7 @@ litest_setup_tests_lid(void)
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);
+ litest_add_no_device("lid:disable_touchpad", lid_suspend_with_touchpad);
+
litest_add_for_device("lid:buggy", lid_update_hw_on_key, LITEST_LID_SWITCH_SURFACE3);
}