[PATCH libinput 2/2] touchpad: drop 'is blacklisted' check for dwt pairing

Peter Hutterer peter.hutterer at who-t.net
Fri Feb 10 05:45:16 UTC 2017


dwt is needed on internal touchpads only and those external ones that are a
combo device. This also now gives us the same check for palm detect and dwt.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 54 ++++++++++++++++---------------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index f8c5cc6..d46a129 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1487,23 +1487,6 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
 }
 
 static bool
-tp_dwt_device_is_blacklisted(struct evdev_device *device)
-{
-	unsigned int bus = libevdev_get_id_bustype(device->evdev);
-	unsigned int vendor_id = libevdev_get_id_vendor(device->evdev);
-
-	/* evemu will set the right bus type */
-	if (bus == BUS_VIRTUAL || bus == BUS_BLUETOOTH)
-		return true;
-
-	/* Wacom doesn't have devices that need dwt */
-	if (vendor_id == VENDOR_ID_WACOM)
-		return true;
-
-	return false;
-}
-
-static bool
 tp_want_dwt(struct evdev_device *touchpad,
 	    struct evdev_device *keyboard)
 {
@@ -1514,10 +1497,6 @@ tp_want_dwt(struct evdev_device *touchpad,
 	unsigned int product_tp = evdev_device_get_id_product(touchpad);
 	unsigned int product_kbd = evdev_device_get_id_product(keyboard);
 
-	if (tp_dwt_device_is_blacklisted(touchpad) ||
-	    tp_dwt_device_is_blacklisted(keyboard))
-		return false;
-
 	/* External touchpads with the same vid/pid as the keyboard are
 	   considered a happy couple */
 	if (touchpad->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD)
@@ -2175,11 +2154,27 @@ tp_dwt_config_get_default(struct libinput_device *device)
 		LIBINPUT_CONFIG_DWT_DISABLED;
 }
 
+static inline bool
+tp_is_tpkb_combo_below(struct evdev_device *device)
+{
+	const char *prop;
+	enum tpkbcombo_layout layout = TPKBCOMBO_LAYOUT_UNKNOWN;
+
+	prop = udev_device_get_property_value(device->udev_device,
+					      "LIBINPUT_ATTR_TPKBCOMBO_LAYOUT");
+	if (!prop)
+		return false;
+
+	return parse_tpkbcombo_layout_poperty(prop, &layout) &&
+		layout == TPKBCOMBO_LAYOUT_BELOW;
+}
+
 static void
 tp_init_dwt(struct tp_dispatch *tp,
 	    struct evdev_device *device)
 {
-	if (tp_dwt_device_is_blacklisted(device))
+	if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD &&
+	    !tp_is_tpkb_combo_below(device))
 		return;
 
 	tp->dwt.config.is_available = tp_dwt_config_is_available;
@@ -2192,21 +2187,6 @@ tp_init_dwt(struct tp_dispatch *tp,
 	return;
 }
 
-static inline bool
-tp_is_tpkb_combo_below(struct evdev_device *device)
-{
-	const char *prop;
-	enum tpkbcombo_layout layout = TPKBCOMBO_LAYOUT_UNKNOWN;
-
-	prop = udev_device_get_property_value(device->udev_device,
-					      "LIBINPUT_ATTR_TPKBCOMBO_LAYOUT");
-	if (!prop)
-		return false;
-
-	return parse_tpkbcombo_layout_poperty(prop, &layout) &&
-		layout == TPKBCOMBO_LAYOUT_BELOW;
-}
-
 static void
 tp_init_palmdetect(struct tp_dispatch *tp,
 		   struct evdev_device *device)
-- 
2.9.3



More information about the wayland-devel mailing list