summaryrefslogtreecommitdiff
path: root/libevdev/libevdev.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-01-17 10:15:33 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-01-22 09:15:14 +1000
commit642c91fc6a5e55cead3bd85bbc599792fcd6df50 (patch)
tree85f81c223fc7005029c45d75b13a8270070b163d /libevdev/libevdev.c
parent0c0188698554a00eb0d910ef7610998156724f49 (diff)
downloadlibevdev-642c91fc6a5e55cead3bd85bbc599792fcd6df50.tar.gz
Warn about a SYN_DROPPED right after finishing a sync
If the first event after a completed device sync is a SYN_DROPPED, warn the user that they're not fast enough handling this device. The test for this is rather complicated since we can't write SYN_DROPPED through uinput so we have to juggle the device fd and a pipe and switch between the two at the right time (taking into account that libevdev will read events from the fd whenever it can). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'libevdev/libevdev.c')
-rw-r--r--libevdev/libevdev.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 59625a4..cf532e3 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -816,8 +816,6 @@ libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event
dev->sync_state = SYNC_NONE;
}
- /* FIXME: if the first event after SYNC_IN_PROGRESS is a SYN_DROPPED, log this */
-
/* Always read in some more events. Best case this smoothes over a potential SYN_DROPPED,
worst case we don't read fast enough and end up with SYN_DROPPED anyway.
@@ -856,8 +854,15 @@ libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event
if (flags & LIBEVDEV_READ_FLAG_SYNC && dev->queue_nsync > 0) {
dev->queue_nsync--;
rc = LIBEVDEV_READ_STATUS_SYNC;
- if (dev->queue_nsync == 0)
+ if (dev->queue_nsync == 0) {
+ struct input_event next;
dev->sync_state = SYNC_NONE;
+
+ if (queue_peek(dev, 0, &next) == 0 &&
+ next.type == EV_SYN && next.code == SYN_DROPPED)
+ log_info("SYN_DROPPED received after finished "
+ "sync - you're not keeping up\n");
+ }
}
out: