mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-28 06:35:34 +07:00
udev: Fix device matching in the accelerometer
As we were searching by ID_PATH, it would have been possible for us to find a sibling device instead of the device we were looking for. This fixes device matching on the WeTab with the upstream kernel, as it was trying to use the "Asus Laptop extra buttons" device instead of the accelerometer. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
parent
2251933e50
commit
232e1d3e6b
@ -257,7 +257,6 @@ int main (int argc, char** argv)
|
|||||||
|
|
||||||
char devpath[PATH_MAX];
|
char devpath[PATH_MAX];
|
||||||
char *devnode;
|
char *devnode;
|
||||||
const char *id_path;
|
|
||||||
struct udev_enumerate *enumerate;
|
struct udev_enumerate *enumerate;
|
||||||
struct udev_list_entry *list_entry;
|
struct udev_list_entry *list_entry;
|
||||||
|
|
||||||
@ -303,18 +302,10 @@ int main (int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
id_path = udev_device_get_property_value(dev, "ID_PATH");
|
|
||||||
if (id_path == NULL) {
|
|
||||||
fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the children devices and find the devnode */
|
/* Get the children devices and find the devnode */
|
||||||
/* FIXME: use udev_enumerate_add_match_parent() instead */
|
|
||||||
devnode = NULL;
|
devnode = NULL;
|
||||||
enumerate = udev_enumerate_new(udev);
|
enumerate = udev_enumerate_new(udev);
|
||||||
udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path);
|
udev_enumerate_add_match_parent(enumerate, dev);
|
||||||
udev_enumerate_add_match_subsystem(enumerate, "input");
|
|
||||||
udev_enumerate_scan_devices(enumerate);
|
udev_enumerate_scan_devices(enumerate);
|
||||||
udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) {
|
udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) {
|
||||||
struct udev_device *device;
|
struct udev_device *device;
|
||||||
|
Loading…
Reference in New Issue
Block a user