From: Lennart Poettering Date: Wed, 13 Jul 2011 19:49:21 +0000 (+0200) Subject: logind: use new udev_enumerate_add_match_parent() where applicable X-Git-Tag: v30~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eb916cdff570a2ce741fc9b40d7316a77c57c27;p=systemd logind: use new udev_enumerate_add_match_parent() where applicable --- diff --git a/src/logind-dbus.c b/src/logind-dbus.c index e0855f4c..4321ffd9 100644 --- a/src/logind-dbus.c +++ b/src/logind-dbus.c @@ -550,7 +550,7 @@ fail: 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_list_entry *first, *item; int r; @@ -563,6 +563,14 @@ static int trigger_device(Manager *m, const char *prefix) { goto finish; } + if (d) { + if (udev_enumerate_add_match_parent(e, d) < 0) { + r = -EIO; + goto finish; + } + } + + if (udev_enumerate_scan_devices(e) < 0) { r = -EIO; goto finish; @@ -575,9 +583,6 @@ static int trigger_device(Manager *m, const char *prefix) { p = udev_list_entry_get_name(item); - if (prefix && !path_startswith(p, prefix)) - continue; - t = strappend(p, "/uevent"); if (!t) { r = -ENOMEM; @@ -637,7 +642,7 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) { if (r < 0) goto finish; - r = trigger_device(m, sysfs); + r = trigger_device(m, d); finish: free(rule); diff --git a/src/logind.h b/src/logind.h index cdb61280..1f5f9fe4 100644 --- a/src/logind.h +++ b/src/logind.h @@ -38,7 +38,6 @@ * direct client API * * udev: - * enumerate recursively with libudev when triggering * use sysfs in device hash table, not sysname, when fb driver is fixed * * non-local X11 server