uinput doesn't route a SYN_DROPPED, so we neeed to handle fds in
a rather complicated manner. For tests, avoid this and instead force
the library to sync if a specific flag is given.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
if (dev->fd < 0)
return -ENODEV;
- if (!(flags & (LIBEVDEV_READ_NORMAL|LIBEVDEV_READ_SYNC)))
+ if (!(flags & (LIBEVDEV_READ_NORMAL|LIBEVDEV_READ_SYNC|LIBEVDEV_FORCE_SYNC)))
return -EINVAL;
if (flags & LIBEVDEV_READ_SYNC) {
if (rc < 0 && rc != -EAGAIN)
goto out;
+ if (flags & LIBEVDEV_FORCE_SYNC) {
+ dev->need_sync = 1;
+ rc = 1;
+ goto out;
+ }
+
+
if (queue_shift(dev, ev) != 0)
return -EAGAIN;
enum EvdevReadFlags {
LIBEVDEV_READ_SYNC = 1, /**< Process data in sync mode */
LIBEVDEV_READ_NORMAL = 2, /**< Process data in normal mode */
+ LIBEVDEV_FORCE_SYNC = 4, /**< Pretend the next event is a SYN_DROPPED. There is
+ no reason to ever use this except for
+ automated tests, so don't. */
};
/**