[PATCH v2 libevdev] Drain all events before synchronizing after SYN_DROPPED

David Herrmann dh.herrmann at gmail.com
Wed Apr 9 18:01:30 PDT 2014


Hi

On Thu, Apr 10, 2014 at 2:57 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> 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.

I fixed that about 1 year ago. If you call ioctl()s, the kernel
_flushes_ affected events from the queue. So syncing our state via
EVIOCG* will remove events of that type from the queue. We should
simply do the same to our internal queue and we are fine.

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

Sorry, currently on the road for 2 more weeks, so no time to look at
the patch in more detail. Will do that once I get home, just wanted to
point to the kernel-patch..

Thanks
David


More information about the Input-tools mailing list