summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-09-17 09:00:38 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-09-17 09:03:17 +1000
commit77b36de85dbfe3891deeb101f2f8485da1b30baa (patch)
treecf7717ab1e3c6cc800b65c7225b40636eeb31897
parent6c869071fbf355c544b2fa2c4ed53ded36d450d6 (diff)
downloadlibinput-77b36de85dbfe3891deeb101f2f8485da1b30baa.tar.gz
touchpad: reduce the jumping cursor warnings to 5 per day
It's been a while since we really could do something about those jumps, so let's assume most of these are informative and not a bug in libinput. For that let's not spam the user's journal and ratelimit it to a handful a day. Per day because that increases the chance of an error being present in the recent logs if the user does search for it. Related #663 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev-mt-touchpad.c4
-rw-r--r--src/util-time.h6
-rw-r--r--test/test-utils.c1
3 files changed, 9 insertions, 2 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 9ba7604d..59d457b7 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -3667,8 +3667,8 @@ 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);
+ /* 5 warnings per 24 hours should be enough */
+ ratelimit_init(&tp->jump.warning, h2us(24), 5);
/* Set the dpi to that of the x axis, because that's what we normalize
to when needed*/
diff --git a/src/util-time.h b/src/util-time.h
index c28283bd..c239e993 100644
--- a/src/util-time.h
+++ b/src/util-time.h
@@ -63,6 +63,12 @@ s2us(uint64_t s)
return ms2us(s * 1000);
}
+static inline uint64_t
+h2us(uint64_t h)
+{
+ return s2us(h * 3600);
+}
+
static inline uint32_t
us2ms(uint64_t us)
{
diff --git a/test/test-utils.c b/test/test-utils.c
index 6d31c1d5..989adecd 100644
--- a/test/test-utils.c
+++ b/test/test-utils.c
@@ -707,6 +707,7 @@ START_TEST(time_conversion)
ck_assert_int_eq(ns2us(10000), 10);
ck_assert_int_eq(ms2us(10), 10000);
ck_assert_int_eq(s2us(1), 1000000);
+ ck_assert_int_eq(h2us(2), s2us(2 * 60 * 60));
ck_assert_int_eq(us2ms(10000), 10);
}
END_TEST