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 <[email protected]>
---
 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

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to