test: restore default log priority after tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Calling libevdev_enable_event_code() overwrites EV_ABS/EV_REP values

Document this behaviour

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Actually make the min queue size a minimum

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Move read_more_events() up in the file

No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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. 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.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Enable event logging on request

Check an environment variable in the form for
  LIBEVDEV_LOG_EVENTS="error"
or
  LIBEVDEV_LOG_EVENTS="info:event0,event3"

If set, log all or the selected devices to the normal event logger, with the
given priority.

Key codes in the normal alphanumeric range are obfuscated to avoid accidental
leakage of information, higher-order keys are sent as normal.

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