mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-05-01 20:47:59 +02:00
Add a flag for forcing a SYN_DROPPED event
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>
This commit is contained in:
parent
d844e3eb51
commit
bc285acd9a
2 changed files with 11 additions and 1 deletions
|
|
@ -530,7 +530,7 @@ int libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_e
|
||||||
if (dev->fd < 0)
|
if (dev->fd < 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!(flags & (LIBEVDEV_READ_NORMAL|LIBEVDEV_READ_SYNC)))
|
if (!(flags & (LIBEVDEV_READ_NORMAL|LIBEVDEV_READ_SYNC|LIBEVDEV_FORCE_SYNC)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (flags & LIBEVDEV_READ_SYNC) {
|
if (flags & LIBEVDEV_READ_SYNC) {
|
||||||
|
|
@ -558,6 +558,13 @@ int libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_e
|
||||||
if (rc < 0 && rc != -EAGAIN)
|
if (rc < 0 && rc != -EAGAIN)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (flags & LIBEVDEV_FORCE_SYNC) {
|
||||||
|
dev->need_sync = 1;
|
||||||
|
rc = 1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (queue_shift(dev, ev) != 0)
|
if (queue_shift(dev, ev) != 0)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,9 @@ struct libevdev;
|
||||||
enum EvdevReadFlags {
|
enum EvdevReadFlags {
|
||||||
LIBEVDEV_READ_SYNC = 1, /**< Process data in sync mode */
|
LIBEVDEV_READ_SYNC = 1, /**< Process data in sync mode */
|
||||||
LIBEVDEV_READ_NORMAL = 2, /**< Process data in normal 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. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue