diff --git a/src/linux/up-enumerator-udev.c b/src/linux/up-enumerator-udev.c index 36e3887..553f652 100644 --- a/src/linux/up-enumerator-udev.c +++ b/src/linux/up-enumerator-udev.c @@ -66,8 +66,17 @@ device_parent_id (GUdevDevice *dev) return NULL; /* Continue walk if the parent is a "hid" device */ - if (g_strcmp0 (subsystem, "hid") == 0) + if (g_strcmp0 (subsystem, "hid") == 0) { + /* if the parent is under /sys/devices/virtual/misc/uhid, the device should be input devices + * and return the path immediately to make sure they belongs to the correct parent. + * for example: + * root@fedora:/sys/devices/virtual/misc/uhid# ls + * 0005:046D:B01A.0005 0005:05AC:0250.000B dev power subsystem uevent */ + if (g_strrstr (g_udev_device_get_sysfs_path (parent), "/sys/devices/virtual/misc/uhid")) + return g_strdup (g_udev_device_get_sysfs_path (parent)); + return device_parent_id (parent); + } /* Also skip over USB interfaces, we care about full devices */ if (g_strcmp0 (subsystem, "usb") == 0 &&