summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--namedev.c4
-rw-r--r--test/udev-test.pl9
2 files changed, 11 insertions, 2 deletions
diff --git a/namedev.c b/namedev.c
index 0abd4b8041..ea64f3404f 100644
--- a/namedev.c
+++ b/namedev.c
@@ -860,8 +860,8 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev
continue;
dbg_parse("compare name '%s' with '%s'",
- dev->kernel_name, dev->name);
- if (strcmp(dev->kernel_name, class_dev->name) != 0)
+ dev->kernel_name, class_dev->name);
+ if (strncmp_wildcard(class_dev->name, dev->kernel_name, NAME_SIZE) != 0)
continue;
strfieldcpy(udev->name, dev->name);
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 3f48de8f3e..8b967c353c 100644
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -51,6 +51,15 @@ LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n"
EOF
},
{
+ desc => "catch device by wildcard",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "visor/0" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB*", NAME="visor/%n"
+EOF
+ },
+ {
desc => "replace kernel name",
subsys => "tty",
devpath => "class/tty/ttyUSB0",