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.hutte...@who-t.net>
LGTM:
Reviewed-by: Hans de Goede <hdego...@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)
{
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel