[PATCH evemu 2/5] Put a warning in if we sleep for more than 10s
Peter Hutterer
peter.hutterer at who-t.net
Thu Aug 6 17:58:23 PDT 2015
Most likely a bug or a bad recordings, but even when it's not it's good to
know why nothing is happening.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evemu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/evemu.c b/src/evemu.c
index c3079dd..35b2a69 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -825,6 +825,16 @@ int evemu_create_event(struct input_event *ev, int type, int code, int value)
return 0;
}
+static inline unsigned long s2us(unsigned long s)
+{
+ return s * 100000L;
+}
+
+static inline unsigned long us2s(unsigned long us)
+{
+ return us / 100000L;
+}
+
int evemu_read_event_realtime(FILE *fp, struct input_event *ev,
struct timeval *evtime)
{
@@ -840,6 +850,8 @@ int evemu_read_event_realtime(FILE *fp, struct input_event *ev,
*evtime = ev->time;
usec = time_to_long(&ev->time) - time_to_long(evtime);
if (usec > 500) {
+ if (usec > s2us(10))
+ error(INFO, "Sleeping for %lds.\n", us2s(usec));
usleep(usec);
*evtime = ev->time;
}
--
2.4.3
More information about the Input-tools
mailing list