If the caller doesn't sync when it should, process all events regardless

libevdev needs to maintain the correct state of the device, even if the caller
decides to drop all delta events after a SYN_DROPPED.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add a flag for blocking read

Not all clients need nonblocking read, so add a flag to read
in blocking mode. In that mode, events are only read from the fd when
the queue is empty.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Switch to a state machine to handle incomplete syncs

A caller may start syncing but switch back to normal half-way through the
sync. In that case, we need to drop all sync events and continue with
regular events only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If we don't have anything to sync, don't add a EV_SYN event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test: add a few sync test cases for incomplete syncs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Remove leading underscore from libevdev_log

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test: add test for extracting the right slot values on startup

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Sync the initial slot state from the device

libevdev_get_slot_value() needs to return the correct value from the outset.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
README: Drop the details, refer to documentation instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Indent some documentation better

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add a simple example to the documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>