[PATCH xf86-input-libinput] Drain the fd after opening
Peter Hutterer
peter.hutterer at who-t.net
Tue Dec 15 16:15:00 PST 2015
Make sure we discard any events that may have been enqueued before we
re-opened the fd. Specifically, if we're using systemd-logind the fd remains
open when we disable/enable the device, allowing events to queue up on the
fd. These events are then replayed once the device is re-opened.
This only applies to a device being disabled via the protocol, on VT switch
logind closes the fd and we don't see enqueued events.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/xf86libinput.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index ee2165a..2fde9ed 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1175,6 +1175,8 @@ open_restricted(const char *path, int flags, void *data)
}
fd = xf86OpenSerial(pInfo->options);
+ xf86FlushInput(fd);
+
return fd < 0 ? -errno : fd;
}
--
2.5.0
More information about the xorg-devel
mailing list