summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-08-15 10:40:20 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-08-16 07:49:49 +1000
commit5f2fff3c2455ad3580c4c130cf85cb5076838c18 (patch)
tree2d365eebb3471189bd496e8ba714ae213f234f9c /src
parent116cddba69b37246db564c1ddf772c0144c589f0 (diff)
Ensure parent devices are actual parent devices
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@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/xf86libinput.c28
1 files 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)
{