mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-01-04 10:40:12 +01:00
linux: up-enumerator-udev: Find the correct parent id for input devices
The parent id for the devices under "/sys/devices/virtual/misc/uhid/*" points to /sys/devices/virtual/misc/uhid. It will cause the device information to be updated incorrectly. For example, the type for a mouse is updated to "keyboard". This patch makes sure the correct parent id for each input device. Resolves: #268 #286
This commit is contained in:
parent
9ee76826bd
commit
7d7bb84fde
1 changed files with 10 additions and 1 deletions
|
|
@ -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 &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue