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> |
||
|---|---|---|
| doc | ||
| include/linux | ||
| libevdev | ||
| m4 | ||
| test | ||
| tools | ||
| .gitignore | ||
| autogen.sh | ||
| configure.ac | ||
| COPYING | ||
| libevdev.pc.in | ||
| Makefile.am | ||
| README.md | ||
libevdev - wrapper library for evdev input devices
libevdev is a wrapper library for evdev devices. it moves the common tasks when dealing with evdev devices into a library and provides a library interface to the callers, thus avoiding erroneous ioctls, etc.
git://git.freedesktop.org/git/libevdev http://cgit.freedesktop.org/libevdev/
The eventual goal is that libevdev wraps all ioctls available to evdev devices, thus making direct access unnecessary.
Go here for the API documentation: http://www.freedesktop.org/software/libevdev/doc/latest/
File bugs in the freedesktop.org bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev
Patches, questions and general comments should be submitted to the input-tools@lists.freedesktop.org mailing list: http://lists.freedesktop.org/mailman/listinfo/input-tools