summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
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);