libevdev/test
Peter Hutterer 050bca91a1 Drain all events before synchronizing after SYN_DROPPED
The kernel ring buffer drops all events on SYN_DROPPED, but then continues to
fill up again. So by the time we read the events, the kernel's client buffer is
essentially like this:
  SYN_DROPPED, ev1, ev2, ev3, ...., evN

The kernel's device state represents the device after evN, and that is what
the ioctls return. For EV_KEY, EV_SND, EV_LED and EV_SW the kernel removes
potential duplicates from the client buffer [1], it doesn't do so for EV_ABS.

So we can't actually sync while there are events on the wire because the
events represent an earlier state. So simply discard all events in the kernel
buffer, synchronize, and then start processing again. We lose some granularity
but at least the events are correct.

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/input/evdev.c?id=483180281f0ac60d1138710eb21f4b9961901294

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-24 08:17:01 +10:00
..
.gitignore Add a test for EVIOCREVOKE 2014-02-26 07:22:04 +10:00
Makefile.am test: the kernel test build doesn't need to link to libevdev 2014-04-02 11:35:12 +10:00
test-common-uinput.c test: fix memleak when using the test-uinput device 2014-02-27 11:08:51 +10:00
test-common-uinput.h test: provide wrapper for fetching the devnode from a uinput test device 2013-09-13 08:59:06 +10:00
test-common.c test: abort on unexpected log messages 2014-01-22 09:14:40 +10:00
test-common.h test: abort on unexpected log messages 2014-01-22 09:14:40 +10:00
test-compile-pedantic.c test: add a build test for -Wpedantic 2013-11-23 09:00:53 +10:00
test-event-codes.c Provide separate lookup functions for zero-terminated strings 2013-11-01 08:18:41 +10:00
test-event-names.c test: remove NULL test for SW_MAX, 3.13 defines SW_MUTE_DEVICE 2014-01-29 15:08:12 +10:00
test-int-queue.c test: remove a bunch of superfluous empty lines 2014-02-25 13:05:30 +10:00
test-kernel.c test: remove checks for test device creation failure 2014-04-02 11:35:56 +10:00
test-libevdev-events.c Drain all events before synchronizing after SYN_DROPPED 2014-04-24 08:17:01 +10:00
test-libevdev-has-event.c test: remove checks for test device creation failure 2014-04-02 11:35:56 +10:00
test-libevdev-init.c test: restore default log priority after tests 2014-04-08 09:01:50 +10:00
test-link.c test: add basic link test 2013-12-12 13:19:52 +10:00
test-main.c test: whitespace fixes (newlines) 2014-03-05 19:16:08 +10:00
test-uinput.c test: abort on unexpected log messages 2014-01-22 09:14:40 +10:00