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>
This commit is contained in:
Peter Hutterer 2021-09-17 09:00:38 +10:00
parent 6c869071fb
commit 77b36de85d
3 changed files with 9 additions and 2 deletions

View file

@ -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*/

View file

@ -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)
{

View file

@ -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