summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-03-21 21:03:32 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-03-22 09:34:22 +1000
commitd6eef77dd240f5514c1a5b1d08ad268d3b86c64d (patch)
tree7a8d53fe826fa2f325e11762991462b4e84a7365
parentbf5229a601813293477d52797935673ccf09d875 (diff)
touchpad: ratelimit the touch jump tests
In most cases these days touch jumps aren't actually fixable, they don't have any good heuristics we can employ to remove them. And, luckily, in most cases it doesn't matter because the users only notice the issue because of the error message. To avoid spamming the user's log, let's ratelimit it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--doc/user/touchpad-jumping-cursors.rst3
-rw-r--r--src/evdev-mt-touchpad.c12
-rw-r--r--src/evdev-mt-touchpad.h4
3 files changed, 15 insertions, 4 deletions
diff --git a/doc/user/touchpad-jumping-cursors.rst b/doc/user/touchpad-jumping-cursors.rst
index d09cd444..50df6715 100644
--- a/doc/user/touchpad-jumping-cursors.rst
+++ b/doc/user/touchpad-jumping-cursors.rst
@@ -14,6 +14,9 @@ position.
When libinput detects a cursor jump it prints a bug warning to the log with
the text **"Touch jump detected and discarded."** and a link to this page.
+.. note:: This warning is ratelimited and will stop appearing after a few
+ times, even if the touchpad jumps continue.
+
In most cases, this is a bug in the kernel driver and to libinput it appears
that the touch point moves from its previous position. The pointer jump can
usually be seen in the :ref:`libinput record <libinput-record>` output for the device:
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c3da8f9d..38745cdf 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1718,10 +1718,11 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
if (tp_detect_jumps(tp, t, time)) {
if (!tp->semi_mt)
- evdev_log_bug_kernel(tp->device,
- "Touch jump detected and discarded.\n"
- "See %stouchpad-jumping-cursors.html for details\n",
- HTTP_DOC_LINK);
+ evdev_log_bug_kernel_ratelimit(tp->device,
+ &tp->jump.warning,
+ "Touch jump detected and discarded.\n"
+ "See %stouchpad-jumping-cursors.html for details\n",
+ HTTP_DOC_LINK);
tp_motion_history_reset(t);
}
@@ -3581,6 +3582,9 @@ tp_init(struct tp_dispatch *tp,
if (!use_touch_size)
tp_init_pressure(tp, device);
+ /* 5 warnings per 2 hours should be enough */
+ ratelimit_init(&tp->jump.warning, s2us(2 * 60 * 60), 5);
+
/* Set the dpi to that of the x axis, because that's what we normalize
to when needed*/
device->dpi = device->abs.absinfo_x->resolution * 25.4;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 0099c0ae..b981a610 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -279,6 +279,10 @@ struct tp_dispatch {
*/
unsigned int fake_touches;
+ struct {
+ struct ratelimit warning;
+ } jump;
+
/* if pressure goes above high -> touch down,
if pressure then goes below low -> touch up */
struct {