Disable 2fg scrolling on Synaptics semi-mt (#1235175)

This commit is contained in:
Peter Hutterer 2015-07-29 08:21:50 +10:00
parent 78cb319ab7
commit 014ea42f09
5 changed files with 636 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From 7ac32de18ca54a3a7d0b8147facc0ba7ebb9dbd4 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 16 Jul 2015 15:54:47 +1000
Subject: [PATCH libinput 1/4] touchpad: remove a leftover check for fake
resolution
obsolete since 8658ff159d416b6a567acb2aaf72b27887ad8576. And once we remove
that all we checkf or is Apple models which we set a resolution for in
systemd. So that check is obsolete now too.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4ca70c813f750721592d1a68aced385560705256)
---
src/evdev-mt-touchpad.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 360f930..80827da 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1464,18 +1464,13 @@ tp_init_palmdetect(struct tp_dispatch *tp,
/* Wacom doesn't have internal touchpads,
* Apple touchpads are always big enough to warrant palm detection */
- if (device->model == EVDEV_MODEL_WACOM_TOUCHPAD) {
+ if (device->model == EVDEV_MODEL_WACOM_TOUCHPAD)
return 0;
- } else if (device->model != EVDEV_MODEL_APPLE_TOUCHPAD) {
- /* We don't know how big the touchpad is */
- if (device->abs.absinfo_x->resolution == 1)
- return 0;
- /* Enable palm detection on touchpads >= 70 mm. Anything smaller
- probably won't need it, until we find out it does */
- if (width/device->abs.absinfo_x->resolution < 70)
- return 0;
- }
+ /* Enable palm detection on touchpads >= 70 mm. Anything smaller
+ probably won't need it, until we find out it does */
+ if (width/device->abs.absinfo_x->resolution < 70)
+ return 0;
/* palm edges are 5% of the width on each side */
tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05;
--
2.4.3

View File

@ -0,0 +1,213 @@
From da530d630f78bc208a35fd1a6912397253f8db87 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 16 Jul 2015 15:59:01 +1000
Subject: [PATCH libinput 2/4] evdev: allow for multiple LIBINPUT_MODEL_* flags
per device
On some devices we need to set more than one flag, i.e. make it into actual
flags.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit aacf40341dc13761d564ecf910dc833073ae39ae)
---
src/evdev-mt-touchpad-buttons.c | 17 +++++++----------
src/evdev-mt-touchpad.c | 12 ++++--------
src/evdev.c | 11 ++++++-----
src/evdev.h | 22 +++++++++++-----------
udev/90-libinput-model-quirks.rules.in | 10 ++--------
5 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 5ecdccd..6852758 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -641,22 +641,19 @@ static enum libinput_config_click_method
tp_click_get_default_method(struct tp_dispatch *tp)
{
struct evdev_device *device = tp->device;
+ uint32_t clickfinger_models = EVDEV_MODEL_CHROMEBOOK |
+ EVDEV_MODEL_SYSTEM76_BONOBO |
+ EVDEV_MODEL_SYSTEM76_GALAGO |
+ EVDEV_MODEL_SYSTEM76_KUDU |
+ EVDEV_MODEL_CLEVO_W740SU;
if (!tp->buttons.is_clickpad)
return LIBINPUT_CONFIG_CLICK_METHOD_NONE;
else if (libevdev_get_id_vendor(tp->device->evdev) == VENDOR_ID_APPLE)
return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
- switch (device->model) {
- case EVDEV_MODEL_CHROMEBOOK:
- case EVDEV_MODEL_SYSTEM76_BONOBO:
- case EVDEV_MODEL_SYSTEM76_GALAGO:
- case EVDEV_MODEL_SYSTEM76_KUDU:
- case EVDEV_MODEL_CLEVO_W740SU:
+ if (device->model_flags & clickfinger_models)
return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
- default:
- break;
- }
return LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
}
@@ -688,7 +685,7 @@ tp_init_middlebutton_emulation(struct tp_dispatch *tp,
if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE)) {
enable_by_default = true;
want_config_option = false;
- } else if (device->model == EVDEV_MODEL_ALPS_TOUCHPAD) {
+ } else if (device->model_flags & EVDEV_MODEL_ALPS_TOUCHPAD) {
enable_by_default = true;
want_config_option = true;
} else
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 80827da..c5c54bb 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1228,7 +1228,7 @@ evdev_tag_touchpad(struct evdev_device *device,
*/
bustype = libevdev_get_id_bustype(device->evdev);
if (bustype == BUS_USB) {
- if (device->model == EVDEV_MODEL_APPLE_TOUCHPAD)
+ if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD)
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
} else if (bustype != BUS_BLUETOOTH)
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
@@ -1354,14 +1354,10 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
tp->accel.x_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_x;
tp->accel.y_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_y;
- switch (tp->device->model) {
- case EVDEV_MODEL_LENOVO_X230:
+ if (tp->device->model_flags & EVDEV_MODEL_LENOVO_X230)
profile = touchpad_lenovo_x230_accel_profile;
- break;
- default:
+ else
profile = touchpad_accel_profile_linear;
- break;
- }
if (evdev_device_init_pointer_acceleration(tp->device, profile) == -1)
return -1;
@@ -1464,7 +1460,7 @@ tp_init_palmdetect(struct tp_dispatch *tp,
/* Wacom doesn't have internal touchpads,
* Apple touchpads are always big enough to warrant palm detection */
- if (device->model == EVDEV_MODEL_WACOM_TOUCHPAD)
+ if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
return 0;
/* Enable palm detection on touchpads >= 70 mm. Anything smaller
diff --git a/src/evdev.c b/src/evdev.c
index 950b334..2e757d8 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1521,8 +1521,8 @@ evdev_read_dpi_prop(struct evdev_device *device)
return dpi;
}
-static inline enum evdev_device_model
-evdev_read_model(struct evdev_device *device)
+static inline uint32_t
+evdev_read_model_flags(struct evdev_device *device)
{
const struct model_map {
const char *property;
@@ -1540,15 +1540,16 @@ evdev_read_model(struct evdev_device *device)
{ NULL, EVDEV_MODEL_DEFAULT },
};
const struct model_map *m = model_map;
+ uint32_t model_flags = 0;
while (m->property) {
if (!!udev_device_get_property_value(device->udev_device,
m->property))
- break;
+ model_flags |= m->model;
m++;
}
- return m->model;
+ return model_flags;
}
static inline int
@@ -2142,7 +2143,7 @@ evdev_device_create(struct libinput_seat *seat,
device->scroll.direction = 0;
device->scroll.wheel_click_angle =
evdev_read_wheel_click_prop(device);
- device->model = evdev_read_model(device);
+ device->model_flags = evdev_read_model_flags(device);
device->dpi = DEFAULT_MOUSE_DPI;
/* at most 5 SYN_DROPPED log-messages per 30s */
diff --git a/src/evdev.h b/src/evdev.h
index 77db1b4..363f93b 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -95,16 +95,16 @@ enum evdev_middlebutton_event {
};
enum evdev_device_model {
- EVDEV_MODEL_DEFAULT,
- EVDEV_MODEL_LENOVO_X230,
- EVDEV_MODEL_CHROMEBOOK,
- EVDEV_MODEL_SYSTEM76_BONOBO,
- EVDEV_MODEL_SYSTEM76_GALAGO,
- EVDEV_MODEL_SYSTEM76_KUDU,
- EVDEV_MODEL_CLEVO_W740SU,
- EVDEV_MODEL_APPLE_TOUCHPAD,
- EVDEV_MODEL_WACOM_TOUCHPAD,
- EVDEV_MODEL_ALPS_TOUCHPAD,
+ EVDEV_MODEL_DEFAULT = 0,
+ EVDEV_MODEL_LENOVO_X230 = (1 << 0),
+ EVDEV_MODEL_CHROMEBOOK = (1 << 1),
+ EVDEV_MODEL_SYSTEM76_BONOBO = (1 << 2),
+ EVDEV_MODEL_SYSTEM76_GALAGO = (1 << 3),
+ EVDEV_MODEL_SYSTEM76_KUDU = (1 << 4),
+ EVDEV_MODEL_CLEVO_W740SU = (1 << 5),
+ EVDEV_MODEL_APPLE_TOUCHPAD = (1 << 6),
+ EVDEV_MODEL_WACOM_TOUCHPAD = (1 << 7),
+ EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
};
struct mt_slot {
@@ -221,7 +221,7 @@ struct evdev_device {
int dpi; /* HW resolution */
struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */
- enum evdev_device_model model;
+ uint32_t model_flags;
};
#define EVDEV_UNHANDLED_DEVICE ((struct evdev_device *) 1)
diff --git a/udev/90-libinput-model-quirks.rules.in b/udev/90-libinput-model-quirks.rules.in
index d834155..5b07726 100644
--- a/udev/90-libinput-model-quirks.rules.in
+++ b/udev/90-libinput-model-quirks.rules.in
@@ -25,18 +25,12 @@ KERNELS=="*input*", \
IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:fwversion:$env{LIBINPUT_MODEL_FIRMWARE_VERSION}'"
# End of touchpad firmware detection
-# Matches below are exclusive, if one matches we skip the rest
-# hwdb matches:
-#
# libinput:touchpad:<modalias>
ENV{ID_INPUT_TOUCHPAD}=="1", \
- IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:", \
- GOTO="libinput_model_quirks_end"
+ IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:"
# libinput:name:<name>:dmi:<dmi string>
KERNELS=="input*", \
- IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'", \
- GOTO="libinput_model_quirks_end"
-
+ IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'"
LABEL="libinput_model_quirks_end"
--
2.4.3

View File

@ -0,0 +1,114 @@
From 7c249ed9722f411e0acdd12e14dc81c617309974 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 16 Jul 2015 16:05:48 +1000
Subject: [PATCH libinput 3/4] Tag synaptics serial touchpads with a
LIBINPUT_MODEL tag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit ab016fd8ed84b58a8f9cabc958cd91ebb4110e57)
---
src/evdev.c | 1 +
src/evdev.h | 1 +
src/libinput-util.h | 2 ++
test/device.c | 23 +++++++++++++++++++++++
udev/90-libinput-model-quirks.hwdb | 6 ++++++
5 files changed, 33 insertions(+)
diff --git a/src/evdev.c b/src/evdev.c
index 2e757d8..96ad2a7 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1537,6 +1537,7 @@ evdev_read_model_flags(struct evdev_device *device)
{ "LIBINPUT_MODEL_APPLE_TOUCHPAD", EVDEV_MODEL_APPLE_TOUCHPAD },
{ "LIBINPUT_MODEL_WACOM_TOUCHPAD", EVDEV_MODEL_WACOM_TOUCHPAD },
{ "LIBINPUT_MODEL_ALPS_TOUCHPAD", EVDEV_MODEL_ALPS_TOUCHPAD },
+ { "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD },
{ NULL, EVDEV_MODEL_DEFAULT },
};
const struct model_map *m = model_map;
diff --git a/src/evdev.h b/src/evdev.h
index 363f93b..6a71232 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -105,6 +105,7 @@ enum evdev_device_model {
EVDEV_MODEL_APPLE_TOUCHPAD = (1 << 6),
EVDEV_MODEL_WACOM_TOUCHPAD = (1 << 7),
EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
+ EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9),
};
struct mt_slot {
diff --git a/src/libinput-util.h b/src/libinput-util.h
index f27bcfd..85fc93a 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -37,6 +37,8 @@
#define VENDOR_ID_APPLE 0x5ac
#define VENDOR_ID_WACOM 0x56a
+#define VENDOR_ID_SYNAPTICS_SERIAL 0x002
+#define PRODUCT_ID_SYNAPTICS_SERIAL 0x007
/* The HW DPI rate we normalize to before calculating pointer acceleration */
#define DEFAULT_MOUSE_DPI 1000
diff --git a/test/device.c b/test/device.c
index f43228c..59939d6 100644
--- a/test/device.c
+++ b/test/device.c
@@ -1008,6 +1008,28 @@ START_TEST(device_udev_tag_apple)
udev_device_unref(d);
}
END_TEST
+
+START_TEST(device_udev_tag_synaptics_serial)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput_device *device = dev->libinput_device;
+ struct udev_device *d;
+ const char *prop;
+
+ d = libinput_device_get_udev_device(device);
+ prop = udev_device_get_property_value(d,
+ "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD");
+
+ if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL &&
+ libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL)
+ ck_assert_notnull(prop);
+ else
+ ck_assert(prop == NULL);
+
+ udev_device_unref(d);
+}
+END_TEST
+
void
litest_setup_tests(void)
{
@@ -1054,4 +1076,5 @@ litest_setup_tests(void)
litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY);
+ litest_add("device:udev tags", device_udev_tag_synaptics_serial, LITEST_TOUCHPAD, LITEST_ANY);
}
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index eec00b6..a34b8f1 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -71,6 +71,12 @@ libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX230*
LIBINPUT_MODEL_LENOVO_X230=1
##########################################
+# Synaptics
+##########################################
+libinput:touchpad:input:b0011v0002p0007*
+ LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD=1
+
+##########################################
# System76
##########################################
--
2.4.3

View File

@ -0,0 +1,253 @@
From a4923241ca5b14e78224b50f9b0056f940e0cb7d Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 14 Jul 2015 10:27:46 +1000
Subject: [PATCH libinput 4/4] touchpad: disable 2fg scrolling on Synaptics
semi-mt touchpads
These touchpads have a terrible resolution when two fingers are down, causing
scrolling to jump around a lot. That then turns into bug reports that we can't
do much about, the data is simply garbage.
https://bugs.freedesktop.org/show_bug.cgi?id=91135
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit eb146677eb5abb7951af4ead80874c992915b90d)
---
doc/scrolling.dox | 7 +++++++
src/evdev-mt-touchpad.c | 36 +++++++++++++++++++++++++++++-------
src/evdev.c | 1 +
src/evdev.h | 1 +
test/litest-device-synaptics-hover.c | 10 ++++++++++
test/touchpad.c | 21 ++++++++++++++++++---
udev/libinput-model-quirks.c | 26 ++++++++++++++++++++++++++
7 files changed, 92 insertions(+), 10 deletions(-)
diff --git a/doc/scrolling.dox b/doc/scrolling.dox
index 658fe4b..0c03c98 100644
--- a/doc/scrolling.dox
+++ b/doc/scrolling.dox
@@ -44,6 +44,13 @@ movements will translate into tiny scroll movements.
Scrolling in both directions at once is possible by meeting the required
distance thresholds to enable each direction separately.
+Two-finger scrolling requires the touchpad to track both touch points with
+reasonable precision. Unfortunately, some so-called "semi-mt" touchpads can
+only track the bounding box of the two fingers rather than the actual
+position of each finger. In addition, that bounding box usually suffers from
+a low resolution, causing jumpy movement during two-finger scrolling.
+libinput does not provide two-finger scrolling on those touchpads.
+
@section edge_scrolling Edge scrolling
On some touchpads, edge scrolling is available, triggered by moving a single
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c5c54bb..a9f4000 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1366,18 +1366,29 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
}
static uint32_t
-tp_scroll_config_scroll_method_get_methods(struct libinput_device *device)
+tp_scroll_get_methods(struct tp_dispatch *tp)
{
- struct evdev_device *evdev = (struct evdev_device*)device;
- struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
uint32_t methods = LIBINPUT_CONFIG_SCROLL_EDGE;
- if (tp->ntouches >= 2)
+ /* some Synaptics semi-mt touchpads have a terrible 2fg resolution,
+ * causing scroll jumps. For all other 2fg touchpads, we enable 2fg
+ * scrolling */
+ if (tp->ntouches >= 2 &&
+ (tp->device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT) == 0)
methods |= LIBINPUT_CONFIG_SCROLL_2FG;
return methods;
}
+static uint32_t
+tp_scroll_config_scroll_method_get_methods(struct libinput_device *device)
+{
+ struct evdev_device *evdev = (struct evdev_device*)device;
+ struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
+
+ return tp_scroll_get_methods(tp);
+}
+
static enum libinput_config_status
tp_scroll_config_scroll_method_set_method(struct libinput_device *device,
enum libinput_config_scroll_method method)
@@ -1409,10 +1420,21 @@ tp_scroll_config_scroll_method_get_method(struct libinput_device *device)
static enum libinput_config_scroll_method
tp_scroll_get_default_method(struct tp_dispatch *tp)
{
- if (tp->ntouches >= 2)
- return LIBINPUT_CONFIG_SCROLL_2FG;
+ uint32_t methods;
+ enum libinput_config_scroll_method method;
+
+ methods = tp_scroll_get_methods(tp);
+
+ if (methods & LIBINPUT_CONFIG_SCROLL_2FG)
+ method = LIBINPUT_CONFIG_SCROLL_2FG;
else
- return LIBINPUT_CONFIG_SCROLL_EDGE;
+ method = LIBINPUT_CONFIG_SCROLL_EDGE;
+
+ if ((methods & method) == 0)
+ log_bug_libinput(tp_libinput_context(tp),
+ "Invalid default scroll method %d\n",
+ method);
+ return method;
}
static enum libinput_config_scroll_method
diff --git a/src/evdev.c b/src/evdev.c
index 96ad2a7..35fc2a3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1538,6 +1538,7 @@ evdev_read_model_flags(struct evdev_device *device)
{ "LIBINPUT_MODEL_WACOM_TOUCHPAD", EVDEV_MODEL_WACOM_TOUCHPAD },
{ "LIBINPUT_MODEL_ALPS_TOUCHPAD", EVDEV_MODEL_ALPS_TOUCHPAD },
{ "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD },
+ { "LIBINPUT_MODEL_JUMPING_SEMI_MT", EVDEV_MODEL_JUMPING_SEMI_MT },
{ NULL, EVDEV_MODEL_DEFAULT },
};
const struct model_map *m = model_map;
diff --git a/src/evdev.h b/src/evdev.h
index 6a71232..1c4ebc0 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -106,6 +106,7 @@ enum evdev_device_model {
EVDEV_MODEL_WACOM_TOUCHPAD = (1 << 7),
EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9),
+ EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10),
};
struct mt_slot {
diff --git a/test/litest-device-synaptics-hover.c b/test/litest-device-synaptics-hover.c
index 2cc9b72..3c36aff 100644
--- a/test/litest-device-synaptics-hover.c
+++ b/test/litest-device-synaptics-hover.c
@@ -102,6 +102,15 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 }
};
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"synaptics_semi_mt_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"synaptics_semi_mt_end\"\n"
+"\n"
+"ATTRS{name}==\"SynPS/2 Synaptics TouchPad\",\n"
+" ENV{LIBINPUT_MODEL_JUMPING_SEMI_MT}=\"1\"\n"
+"\n"
+"LABEL=\"synaptics_semi_mt_end\"";
+
struct litest_test_device litest_synaptics_hover_device = {
.type = LITEST_SYNAPTICS_HOVER_SEMI_MT,
.features = LITEST_TOUCHPAD | LITEST_SEMI_MT | LITEST_BUTTON,
@@ -114,6 +123,7 @@ struct litest_test_device litest_synaptics_hover_device = {
.id = &input_id,
.events = events,
.absinfo = absinfo,
+ .udev_rule = udev_rule,
};
static void
diff --git a/test/touchpad.c b/test/touchpad.c
index 12bceea..759f82a 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -69,6 +69,16 @@ enable_buttonareas(struct litest_device *dev)
litest_assert_int_eq(status, expected);
}
+static inline int
+is_synaptics_semi_mt(struct litest_device *dev)
+{
+ struct libevdev *evdev = dev->evdev;
+
+ return libevdev_has_property(evdev, INPUT_PROP_SEMI_MT) &&
+ libevdev_get_id_vendor(evdev) == 0x2 &&
+ libevdev_get_id_product(evdev) == 0x7;
+}
+
START_TEST(touchpad_1fg_motion)
{
struct litest_device *dev = litest_current_device();
@@ -1581,10 +1591,14 @@ START_TEST(touchpad_scroll_defaults)
method = libinput_device_config_scroll_get_methods(device);
ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE);
- if (libevdev_get_num_slots(evdev) > 1)
+ if (libevdev_get_num_slots(evdev) > 1 &&
+ !is_synaptics_semi_mt(dev))
ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG);
+ else
+ ck_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0);
- if (libevdev_get_num_slots(evdev) > 1)
+ if (libevdev_get_num_slots(evdev) > 1 &&
+ !is_synaptics_semi_mt(dev))
expected = LIBINPUT_CONFIG_SCROLL_2FG;
else
expected = LIBINPUT_CONFIG_SCROLL_EDGE;
@@ -1600,7 +1614,8 @@ START_TEST(touchpad_scroll_defaults)
status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_2FG);
- if (libevdev_get_num_slots(evdev) > 1)
+ if (libevdev_get_num_slots(evdev) > 1 &&
+ !is_synaptics_semi_mt(dev))
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
else
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
diff --git a/udev/libinput-model-quirks.c b/udev/libinput-model-quirks.c
index fc3dbe8..0e737a4 100644
--- a/udev/libinput-model-quirks.c
+++ b/udev/libinput-model-quirks.c
@@ -69,6 +69,30 @@ handle_touchpad_alps(struct udev_device *device)
}
static void
+handle_touchpad_synaptics(struct udev_device *device)
+{
+ const char *product, *props;
+ int bus, vid, pid, version;
+ int prop;
+
+ product = prop_value(device, "PRODUCT");
+ if (!product)
+ return;
+
+ if (sscanf(product, "%x/%x/%x/%x", &bus, &vid, &pid, &version) != 4)
+ return;
+
+ if (bus != BUS_I8042 || vid != 0x2 || pid != 0x7)
+ return;
+
+ props = prop_value(device, "PROP");
+ if (sscanf(props, "%x", &prop) != 1)
+ return;
+ if (prop & (1 << INPUT_PROP_SEMI_MT))
+ printf("LIBINPUT_MODEL_JUMPING_SEMI_MT=1\n");
+}
+
+static void
handle_touchpad(struct udev_device *device)
{
const char *name = NULL;
@@ -79,6 +103,8 @@ handle_touchpad(struct udev_device *device)
if (strstr(name, "AlpsPS/2 ALPS") != NULL)
handle_touchpad_alps(device);
+ if (strstr(name, "Synaptics ") != NULL)
+ handle_touchpad_synaptics(device);
}
int main(int argc, char **argv)
--
2.4.3

View File

@ -5,7 +5,7 @@
Name: libinput
Version: 0.20.0
Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Release: 4%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Summary: Input device library
License: MIT
@ -23,6 +23,11 @@ Patch05: 0001-udev-don-t-install-the-litest-udev-rules.patch
Patch06: 0001-evdev-restore-pointing-stick-const-accel-property-pa.patch
# Fedora-specific, remove when thumb detection is fixed upstream
Patch07: 0001-Disable-thumb-detection-it-s-too-aggressive-1246093.patch
# Bug 1235175 - Synaptics Touchpad two-finger scrolling jumps
Patch08: 0001-touchpad-remove-a-leftover-check-for-fake-resolution.patch
Patch09: 0002-evdev-allow-for-multiple-LIBINPUT_MODEL_-flags-per-d.patch
Patch10: 0003-Tag-synaptics-serial-touchpads-with-a-LIBINPUT_MODEL.patch
Patch11: 0004-touchpad-disable-2fg-scrolling-on-Synaptics-semi-mt-.patch
BuildRequires: git
BuildRequires: autoconf automake libtool pkgconfig
@ -100,6 +105,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%changelog
* Wed Jul 29 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.20.0-4
- Disable 2fg scrolling on Synaptics semi-mt (#1235175)
* Fri Jul 24 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.20.0-3
- Disable thumb detection, too many false positives (#1246093)