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

Submitted by Peter Hutterer on Aug. 8, 2016, 11:42 p.m.

Details

Message ID 1470699748-29517-1-git-send-email-peter.hutterer@who-t.net
State Accepted
Headers show
Series "Series without cover letter" ( rev: 1 ) in X.org

Not browsing as part of any series.

Commit Message

Peter Hutterer Aug. 8, 2016, 11:42 p.m.
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@who-t.net>
---
 src/xf86libinput.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

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);

Comments

Hi,

On 09-08-16 01:42, Peter Hutterer wrote:
> 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@who-t.net>

Both patches look good to me and are:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  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);
>