[PATCH xf86-input-libinput] Ensure parent devices are actual parent devices

Hans de Goede hdegoede at redhat.com
Mon Aug 15 06:15:05 UTC 2016


Hi,

On 15-08-16 02:57, Peter Hutterer wrote:
> The list returned by xf86FirstLocalDevice() includes our own device. If the
> parent device is removed before the hotplug callback is invoked, the first
> match with the same shared-device ID is our own device (or potentially another
> subdevice on the same already-removed parent). Avoid this by making sure the
> matched device is actually a parent device.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

LGTM:

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

Regards,

Hans



> ---
>  src/xf86libinput.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/src/xf86libinput.c b/src/xf86libinput.c
> index 3bab392..d661fb2 100644
> --- a/src/xf86libinput.c
> +++ b/src/xf86libinput.c
> @@ -214,6 +214,19 @@ btn_xorg2linux(unsigned int b)
>  	return button;
>  }
>
> +static BOOL
> +xf86libinput_is_subdevice(InputInfoPtr pInfo)
> +{
> +	char *source;
> +	BOOL is_subdevice;
> +
> +	source = xf86SetStrOption(pInfo->options, "_source", "");
> +	is_subdevice = strcmp(source, "_driver/libinput") == 0;
> +	free(source);
> +
> +	return is_subdevice;
> +}
> +
>  static inline InputInfoPtr
>  xf86libinput_get_parent(InputInfoPtr pInfo)
>  {
> @@ -228,7 +241,7 @@ xf86libinput_get_parent(InputInfoPtr pInfo)
>  		int id = xf86CheckIntOption(parent->options,
>  					    "_libinput/shared-device",
>  					    -1);
> -		if (id == parent_id)
> +		if (id == parent_id && !xf86libinput_is_subdevice(parent))
>  			return parent;
>  	}
>
> @@ -2473,19 +2486,6 @@ xf86libinput_create_subdevice(InputInfoPtr pInfo,
>  	return NULL;
>  }
>
> -static BOOL
> -xf86libinput_is_subdevice(InputInfoPtr pInfo)
> -{
> -	char *source;
> -	BOOL is_subdevice;
> -
> -	source = xf86SetStrOption(pInfo->options, "_source", "");
> -	is_subdevice = strcmp(source, "_driver/libinput") == 0;
> -	free(source);
> -
> -	return is_subdevice;
> -}
> -
>  static inline uint32_t
>  caps_from_options(InputInfoPtr pInfo)
>  {
>


More information about the xorg-devel mailing list