summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-03-28 11:22:17 +0200
committerGreg KH <gregkh@suse.de>2005-04-26 23:55:00 -0700
commit98bbc835f584ed6792e895519326cc637f64f411 (patch)
treec7dd4680249ead5d3a8cbb1b3a65df7c297a1e31 /udev_rules.c
parentaa341f21ebad3cf82fa8ff4f644f80d65ff27a40 (diff)
[PATCH] read %s{}-sysfs values at any device in the chain
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/udev_rules.c b/udev_rules.c
index 2fca33d063..00199a062f 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -287,8 +287,18 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize,
break;
}
if (find_sysfs_attribute(class_dev, sysfs_device, attr, temp2, sizeof(temp2)) != 0) {
- dbg("sysfs attribute '%s' not found", attr);
- break;
+ struct sysfs_device *parent_device;
+
+ dbg("sysfs attribute '%s' not found, walk up the physical devices", attr);
+ parent_device = sysfs_get_device_parent(sysfs_device);
+ while (parent_device) {
+ dbg("looking at '%s'", parent_device->path);
+ if (find_sysfs_attribute(NULL, parent_device, attr, temp2, sizeof(temp2)) == 0)
+ break;
+ parent_device = sysfs_get_device_parent(parent_device);
+ }
+ if (!parent_device)
+ break;
}
/* strip trailing whitespace of sysfs value */
i = strlen(temp2);