logind: use new udev_enumerate_add_match_parent() where applicable

This commit is contained in:
Lennart Poettering 2011-07-13 21:49:21 +02:00
parent 309c2a2ce9
commit 2eb916cdff
2 changed files with 10 additions and 6 deletions

View File

@ -550,7 +550,7 @@ fail:
return r; return r;
} }
static int trigger_device(Manager *m, const char *prefix) { static int trigger_device(Manager *m, struct udev_device *d) {
struct udev_enumerate *e; struct udev_enumerate *e;
struct udev_list_entry *first, *item; struct udev_list_entry *first, *item;
int r; int r;
@ -563,6 +563,14 @@ static int trigger_device(Manager *m, const char *prefix) {
goto finish; goto finish;
} }
if (d) {
if (udev_enumerate_add_match_parent(e, d) < 0) {
r = -EIO;
goto finish;
}
}
if (udev_enumerate_scan_devices(e) < 0) { if (udev_enumerate_scan_devices(e) < 0) {
r = -EIO; r = -EIO;
goto finish; goto finish;
@ -575,9 +583,6 @@ static int trigger_device(Manager *m, const char *prefix) {
p = udev_list_entry_get_name(item); p = udev_list_entry_get_name(item);
if (prefix && !path_startswith(p, prefix))
continue;
t = strappend(p, "/uevent"); t = strappend(p, "/uevent");
if (!t) { if (!t) {
r = -ENOMEM; r = -ENOMEM;
@ -637,7 +642,7 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
if (r < 0) if (r < 0)
goto finish; goto finish;
r = trigger_device(m, sysfs); r = trigger_device(m, d);
finish: finish:
free(rule); free(rule);

View File

@ -38,7 +38,6 @@
* direct client API * direct client API
* *
* udev: * udev:
* enumerate recursively with libudev when triggering
* use sysfs in device hash table, not sysname, when fb driver is fixed * use sysfs in device hash table, not sysname, when fb driver is fixed
* *
* non-local X11 server * non-local X11 server