[PATCH libevdev] In debug mode, print the events libevdev processes
Peter Hutterer
peter.hutterer at who-t.net
Mon Mar 17 19:51:58 PDT 2014
Sometimes bugs are really hard to reproduce with an external reader.
Putting a printf statement into the caller can be useful, but doesn't
necessarily reflect the actual events libevdev handles internally.
Thus, in debug mode, print exactly the event we're dealing with.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
I'm a bit in two minds about this, feedback appreciated.
libevdev/libevdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 0730d99..84d9195 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -915,6 +915,11 @@ libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event
dev->queue_nsync--;
sanitize_event(dev, &e);
update_state(dev, &e);
+ log_dbg("internal sync event type %s (%d) code %s (%d) value %d\n",
+ libevdev_event_type_get_name(e.type), e.type,
+ libevdev_event_code_get_name(e.type, e.code), e.code,
+ e.value);
+
}
dev->sync_state = SYNC_NONE;
@@ -944,6 +949,12 @@ libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event
if (queue_shift(dev, ev) != 0)
return -EAGAIN;
+ log_dbg("%sevent type %s (%d) code %s (%d) value %d\n",
+ (flags & LIBEVDEV_READ_FLAG_SYNC) ? "sync " : "",
+ libevdev_event_type_get_name(ev->type), ev->type,
+ libevdev_event_code_get_name(ev->type, ev->code), ev->code,
+ ev->value);
+
sanitize_event(dev, ev);
update_state(dev, ev);
--
1.8.5.3
More information about the Input-tools
mailing list