[PATCH libinput 1/2] touchpad: add a hwdb quirk for (external) touchpad/keyboard combos
Peter Hutterer
peter.hutterer at who-t.net
Fri Feb 10 05:45:15 UTC 2017
Specify the layout of the combo so we know when to initialize palm detection.
This allows us to drop palm detection on external touchpads otherwise,
replacing the wacom-specific check with something more generic..
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev-mt-touchpad.c | 19 +++++++++++++++++--
src/libinput-util.c | 24 ++++++++++++++++++++++++
src/libinput-util.h | 7 +++++++
test/test-touchpad.c | 4 ++++
udev/90-libinput-model-quirks.hwdb | 7 +++++++
udev/parse_hwdb.py | 7 ++++++-
6 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c5eeeac..f8c5cc6 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2192,6 +2192,21 @@ 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)
@@ -2203,8 +2218,8 @@ tp_init_palmdetect(struct tp_dispatch *tp,
tp->palm.right_edge = INT_MAX;
tp->palm.left_edge = INT_MIN;
- /* Wacom doesn't have internal touchpads */
- if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
+ if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD &&
+ !tp_is_tpkb_combo_below(device))
return;
evdev_device_get_size(device, &width, &height);
diff --git a/src/libinput-util.c b/src/libinput-util.c
index d75955c..351bbe4 100644
--- a/src/libinput-util.c
+++ b/src/libinput-util.c
@@ -336,6 +336,30 @@ parse_switch_reliability_property(const char *prop,
}
/**
+ * Parses a string with the allowed values: "below"
+ * The value refers to the position of the touchpad (relative to the
+ * keyboard, i.e. your average laptop would be 'below')
+ *
+ * @param prop The value of the property
+ * @param layout The layout
+ * @return true on success, false otherwise
+ */
+bool
+parse_tpkbcombo_layout_poperty(const char *prop,
+ enum tpkbcombo_layout *layout)
+{
+ if (!prop)
+ return false;
+
+ if (streq(prop, "below")) {
+ *layout = TPKBCOMBO_LAYOUT_BELOW;
+ return true;
+ }
+
+ return false;
+}
+
+/**
* Return the next word in a string pointed to by state before the first
* separator character. Call repeatedly to tokenize a whole string.
*
diff --git a/src/libinput-util.h b/src/libinput-util.h
index 00ece58..d86ff12 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -379,6 +379,13 @@ double parse_trackpoint_accel_property(const char *prop);
bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
bool parse_calibration_property(const char *prop, float calibration[6]);
+enum tpkbcombo_layout {
+ TPKBCOMBO_LAYOUT_UNKNOWN,
+ TPKBCOMBO_LAYOUT_BELOW,
+};
+bool parse_tpkbcombo_layout_poperty(const char *prop,
+ enum tpkbcombo_layout *layout);
+
enum switch_reliability {
RELIABILITY_UNKNOWN,
RELIABILITY_RELIABLE,
diff --git a/test/test-touchpad.c b/test/test-touchpad.c
index aca9f7b..4656443 100644
--- a/test/test-touchpad.c
+++ b/test/test-touchpad.c
@@ -933,11 +933,15 @@ touchpad_has_palm_detect_size(struct litest_device *dev)
{
double width, height;
unsigned int vendor;
+ unsigned int bustype;
int rc;
vendor = libinput_device_get_id_vendor(dev->libinput_device);
+ bustype = libevdev_get_id_bustype(dev->evdev);
if (vendor == VENDOR_ID_WACOM)
return 0;
+ if (bustype == BUS_BLUETOOTH)
+ return 0;
if (vendor == VENDOR_ID_APPLE)
return 1;
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index 412d872..c1d6235 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -60,6 +60,13 @@ libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*svnASUSTeKCOMPUTERINC.:pnX555LAB:*
LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER=1
##########################################
+# Chicony
+##########################################
+# Acer Hawaii Keyboard, uses Chicony VID
+libinput:touchpad:input:b0003v04F2p1558*
+ LIBINPUT_ATTR_TPKBCOMBO_LAYOUT=below
+
+##########################################
# Cyborg
##########################################
# Saitek Cyborg R.A.T.5 Mouse
diff --git a/udev/parse_hwdb.py b/udev/parse_hwdb.py
index d079be2..2a342bf 100755
--- a/udev/parse_hwdb.py
+++ b/udev/parse_hwdb.py
@@ -107,7 +107,12 @@ def property_grammar():
Suppress('=') -
reliability_tags('VALUE')]
- grammar = Or(model_props + size_props + reliability)
+ tpkbcombo_tags = Or(('below'))
+ tpkbcombo = [Literal('LIBINPUT_ATTR_TPKBCOMBO_LAYOUT')('NAME') -
+ Suppress('=') -
+ tpkbcombo_tags('VALUE')]
+
+ grammar = Or(model_props + size_props + reliability + tpkbcombo)
return grammar
--
2.9.3
More information about the wayland-devel
mailing list