evdev: Log evdev event queue overflows
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 29 Oct 2014 14:56:27 +0000 (09:56 -0500)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 31 Oct 2014 03:42:32 +0000 (13:42 +1000)
Log a message when the kernel event queue overflows and events are dropped.
After 10 messages logging stops to avoid flooding the logs if the condition
is persistent.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev.c
src/evdev.h

index dd2228bf7f896df780faad9d7cb31b31462c6285..e5e7bfdd51b36633ebd86a83244957a560b4b8ae 100644 (file)
@@ -924,6 +924,17 @@ 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++;
+                               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);
+                       }
+
                        /* send one more sync event so we handle all
                           currently pending events before we sync up
                           to the current state */
index c0d65771cdf2cdfef940ec75880b9607e74dd41b..9e846238e67dfd51b76b8758f0002a0d3285b47e 100644 (file)
@@ -135,6 +135,10 @@ struct evdev_device {
                /* Checks if buttons are down and commits the setting */
                void (*change_to_left_handed)(struct evdev_device *device);
        } buttons;
+
+       /* The number of times libevdev processes a SYN_DROPPED, so we can
+        * stop logging them to avoid flooding the logs. */
+       int syn_drops_received;
 };
 
 #define EVDEV_UNHANDLED_DEVICE ((struct evdev_device *) 1)