summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2007-07-25 15:24:58 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-07-25 15:24:58 +0200
commitfea9b2d2924235a459e888ecd35a8b43093b9542 (patch)
tree250753611ef74d2b2e8a3a35da50f99ff6b26e24 /udev_rules.c
parent76bd9d319e0d4376d14032cd65503da3a6c2529e (diff)
add $driver subtitution
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/udev_rules.c b/udev_rules.c
index daf3d7fff7..3674a27d63 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -597,6 +597,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
SUBST_KERNEL,
SUBST_KERNEL_NUMBER,
SUBST_ID,
+ SUBST_DRIVER,
SUBST_MAJOR,
SUBST_MINOR,
SUBST_RESULT,
@@ -616,6 +617,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
{ .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER },
{ .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL },
{ .name = "id", .fmt = 'b', .type = SUBST_ID },
+ { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER },
{ .name = "major", .fmt = 'M', .type = SUBST_MAJOR },
{ .name = "minor", .fmt = 'm', .type = SUBST_MINOR },
{ .name = "result", .fmt = 'c', .type = SUBST_RESULT },
@@ -707,6 +709,12 @@ found:
dbg("substitute id '%s'", udev->dev_parent->kernel);
}
break;
+ case SUBST_DRIVER:
+ if (udev->dev_parent != NULL) {
+ strlcat(string, udev->dev_parent->driver, maxsize);
+ dbg("substitute driver '%s'", udev->dev_parent->driver);
+ }
+ break;
case SUBST_MAJOR:
sprintf(temp2, "%d", major(udev->devt));
strlcat(string, temp2, maxsize);