mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
evdev: ratelimit SYN_DROPPED logging
Use the ratelimit helpers for SYN_DROPPED logging. This guarantees that we will still receive SYN_DROPPED log-messages after multiple days of runtime, even though there might have been a SYN_DROPPED flood at one point in time. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
33ac7436a1
commit
6d781f8817
2 changed files with 13 additions and 9 deletions
18
src/evdev.c
18
src/evdev.c
|
|
@ -925,15 +925,19 @@ evdev_device_dispatch(void *data)
|
|||
rc = libevdev_next_event(device->evdev,
|
||||
LIBEVDEV_READ_FLAG_NORMAL, &ev);
|
||||
if (rc == LIBEVDEV_READ_STATUS_SYNC) {
|
||||
if (device->syn_drops_received < 10) {
|
||||
device->syn_drops_received++;
|
||||
switch (ratelimit_test(&device->syn_drop_limit)) {
|
||||
case RATELIMIT_PASS:
|
||||
log_info(libinput, "SYN_DROPPED event from "
|
||||
"\"%s\" - some input events have "
|
||||
"been lost.\n", device->devname);
|
||||
if (device->syn_drops_received == 10)
|
||||
log_info(libinput, "No longer logging "
|
||||
"SYN_DROPPED events for "
|
||||
"\"%s\"\n", device->devname);
|
||||
break;
|
||||
case RATELIMIT_THRESHOLD:
|
||||
log_info(libinput, "SYN_DROPPED flood "
|
||||
"from \"%s\"\n",
|
||||
device->devname);
|
||||
break;
|
||||
case RATELIMIT_EXCEEDED:
|
||||
break;
|
||||
}
|
||||
|
||||
/* send one more sync event so we handle all
|
||||
|
|
@ -1310,6 +1314,8 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
device->scroll.threshold = 5.0; /* Default may be overridden */
|
||||
device->scroll.direction = 0;
|
||||
device->dpi = DEFAULT_MOUSE_DPI;
|
||||
/* at most 5 SYN_DROPPED log-messages per 30s */
|
||||
ratelimit_init(&device->syn_drop_limit, 30ULL * 1000, 5);
|
||||
|
||||
matrix_init_identity(&device->abs.calibration);
|
||||
matrix_init_identity(&device->abs.usermatrix);
|
||||
|
|
|
|||
|
|
@ -137,9 +137,7 @@ struct evdev_device {
|
|||
} buttons;
|
||||
|
||||
int dpi; /* HW resolution */
|
||||
/* The number of times libevdev processes a SYN_DROPPED, so we can
|
||||
* stop logging them to avoid flooding the logs. */
|
||||
int syn_drops_received;
|
||||
struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */
|
||||
};
|
||||
|
||||
#define EVDEV_UNHANDLED_DEVICE ((struct evdev_device *) 1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue