summaryrefslogtreecommitdiff
path: root/udev/udev-event.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-26 02:48:14 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-10-26 02:48:14 +0100
commitdc4c7e463df35776631150e4e18a4ba41749843c (patch)
treef0b78e73ebaf12ab6f8de66d2d2615e2d0420d95 /udev/udev-event.c
parent1822e9b033fcd91a7dfd3b0bfd12cfbbd93fc470 (diff)
fix $attr{[<subsystem>/<sysname>]<attribute>} substitution
Diffstat (limited to 'udev/udev-event.c')
-rw-r--r--udev/udev-event.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index e297df0383..02c5c99dc1 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -295,13 +295,17 @@ found:
size_t size;
value[0] = '\0';
+ /* read the value specified by [usb/]*/
util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1);
- val = udev_device_get_sysattr_value(event->dev, attr);
- if (val != NULL)
- util_strlcpy(value, val, sizeof(value));
+ /* try to read attribute of the current device */
+ if (value[0] == '\0') {
+ val = udev_device_get_sysattr_value(event->dev, attr);
+ if (val != NULL)
+ util_strlcpy(value, val, sizeof(value));
+ }
- /* try the current device, other matches may have selected */
+ /* try to read the attribute of the parent device, other matches have selected */
if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) {
val = udev_device_get_sysattr_value(event->dev_parent, attr);
if (val != NULL)