summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-02-04 11:20:38 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-02-05 07:43:25 +1000
commit0b0150e08d4e3e88d7a81a7429306d8dca2fe4c8 (patch)
tree0717deb89d046646d128411821df31b6d3bf88c2 /src
parentb27f04689e60a9148523124aa610b23dbe173377 (diff)
touchpad: if we have a serio keyboard, override any previous dwt pairing
If a USB keyboard like the YubiKey is found before the internal keyboard, it will be paired with the touchpad when it is seen. The internal keyboard is seen later bug ignored because we already have a keyboard paired with the touchpad. This is obviously wrong. For now, give priority to serio keyboards, and override existing dwt pairings with the new keyboard. https://bugs.freedesktop.org/show_bug.cgi?id=93983 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 9b6c689a..f7d5d873 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1336,6 +1336,38 @@ tp_want_dwt(struct evdev_device *touchpad,
}
static void
+tp_dwt_pair_keyboard(struct evdev_device *touchpad,
+ struct evdev_device *keyboard)
+{
+ struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch;
+ unsigned int bus_kbd = libevdev_get_id_bustype(keyboard->evdev);
+
+ if (!tp_want_dwt(touchpad, keyboard))
+ return;
+
+ /* If we already have a keyboard paired, override it if the new one
+ * is a serio device. Otherwise keep the current one */
+ if (tp->dwt.keyboard) {
+ if (bus_kbd != BUS_I8042)
+ return;
+
+ memset(tp->dwt.key_mask, 0, sizeof(tp->dwt.key_mask));
+ libinput_device_remove_event_listener(&tp->dwt.keyboard_listener);
+ }
+
+ libinput_device_add_event_listener(&keyboard->base,
+ &tp->dwt.keyboard_listener,
+ tp_keyboard_event, tp);
+ tp->dwt.keyboard = keyboard;
+ tp->dwt.keyboard_active = false;
+
+ log_debug(touchpad->base.seat->libinput,
+ "palm: dwt activated with %s<->%s\n",
+ touchpad->devname,
+ keyboard->devname);
+}
+
+static void
tp_interface_device_added(struct evdev_device *device,
struct evdev_device *added_device)
{
@@ -1359,20 +1391,8 @@ tp_interface_device_added(struct evdev_device *device,
tp_trackpoint_event, tp);
}
- if (added_device->tags & EVDEV_TAG_KEYBOARD &&
- tp->dwt.keyboard == NULL &&
- tp_want_dwt(device, added_device)) {
- log_debug(tp_libinput_context(tp),
- "palm: dwt activated with %s<->%s\n",
- device->devname,
- added_device->devname);
-
- libinput_device_add_event_listener(&added_device->base,
- &tp->dwt.keyboard_listener,
- tp_keyboard_event, tp);
- tp->dwt.keyboard = added_device;
- tp->dwt.keyboard_active = false;
- }
+ if (added_device->tags & EVDEV_TAG_KEYBOARD)
+ tp_dwt_pair_keyboard(device, added_device);
if (tp->sendevents.current_mode !=
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)