mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-05-09 04:48:03 +02:00
test: provide a function to print an event
Easy to copy/paste into a test that needs a bit of debugging, otherwise unused. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
1014acedfc
commit
58559d9fec
1 changed files with 20 additions and 0 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <libevdev/libevdev.h>
|
#include <libevdev/libevdev.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
|
|
||||||
|
|
@ -87,4 +88,23 @@ void test_logfunc_ignore_error(enum libevdev_log_priority priority,
|
||||||
const char *file, int line,
|
const char *file, int line,
|
||||||
const char *func,
|
const char *func,
|
||||||
const char *format, va_list args);
|
const char *format, va_list args);
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
print_event(const struct input_event *ev)
|
||||||
|
{
|
||||||
|
if (ev->type == EV_SYN)
|
||||||
|
printf("Event: time %ld.%06ld, ++++++++++++++++++++ %s +++++++++++++++\n",
|
||||||
|
ev->input_event_sec,
|
||||||
|
ev->input_event_usec,
|
||||||
|
libevdev_event_type_get_name(ev->type));
|
||||||
|
else
|
||||||
|
printf("Event: time %ld.%06ld, type %d (%s), code %d (%s), value %d\n",
|
||||||
|
ev->input_event_sec,
|
||||||
|
ev->input_event_usec,
|
||||||
|
ev->type,
|
||||||
|
libevdev_event_type_get_name(ev->type),
|
||||||
|
ev->code,
|
||||||
|
libevdev_event_code_get_name(ev->type, ev->code),
|
||||||
|
ev->value);
|
||||||
|
}
|
||||||
#endif /* _TEST_COMMON_H_ */
|
#endif /* _TEST_COMMON_H_ */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue