[PATCH xf86-input-libinput 1/2] Block input events while creating the virtual subdevices

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 8 23:42:27 UTC 2016


If an event comes in halfway through the new device creation we read it from
libinput's epollfd but depending on the setup stage the new device may not be
ready yet.

https://bugs.freedesktop.org/show_bug.cgi?id=97117

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/xf86libinput.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index fff59b3..5873e45 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2394,10 +2394,20 @@ xf86libinput_hotplug_device(struct xf86libinput_hotplug_info *hotplug)
 {
 	DeviceIntPtr dev;
 
+#if HAVE_THREADED_INPUT
+	input_lock();
+#else
+	int sigstate = xf86BlockSIGIO();
+#endif
 	if (NewInputDeviceRequest(hotplug->input_options,
 				  hotplug->attrs,
 				  &dev) != Success)
 		dev = NULL;
+#if HAVE_THREADED_INPUT
+	input_unlock();
+#else
+	xf86UnblockSIGIO(sigstate);
+#endif
 
 	input_option_free_list(&hotplug->input_options);
 	FreeInputAttributes(hotplug->attrs);
-- 
2.7.4



More information about the xorg-devel mailing list