]> err.no Git - systemd/commitdiff
[PATCH] got REPLACE to work properly.
authorgreg@kroah.com <greg@kroah.com>
Thu, 24 Jul 2003 02:08:16 +0000 (22:08 -0400)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:01:40 +0000 (21:01 -0700)
namedev.c
namedev.config

index 8b7edb7fb1a5ce1f43cabd99959c803e60eab4cb..e1958b5d9f7ad8b8d23270e10179662d76d1fbea 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -419,18 +419,45 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at
 {
        struct list_head *tmp;
        int retval = 0;
+       int found;
 
        list_for_each(tmp, &config_device_list) {
                struct config_device *dev = list_entry(tmp, struct config_device, node);
-               if (strcmp(dev->attr.name, class_dev->name) == 0) {
+               switch (dev->type) {
+               case LABEL:
+                       dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'"
+                               " owner = '%s', group = '%s', mode = '%#o'",
+                               dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value,
+                               dev->attr.owner, dev->attr.group, dev->attr.mode);
+                       break;
+               case NUMBER:
+                       dbg("NUMBER name = '%s', bus = '%s', id = '%s'"
+                               " owner = '%s', group = '%s', mode = '%#o'",
+                               dev->attr.name, dev->bus, dev->id,
+                               dev->attr.owner, dev->attr.group, dev->attr.mode);
+                       break;
+               case TOPOLOGY:
+                       dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'"
+                               " owner = '%s', group = '%s', mode = '%#o'",
+                               dev->attr.name, dev->bus, dev->place,
+                               dev->attr.owner, dev->attr.group, dev->attr.mode);
+                       break;
+               case REPLACE:
+                       if (strcmp(dev->kernel_name, class_dev->name) != 0)
+                               continue;
+                       strcpy(attr->name, dev->attr.name);
                        attr->mode = dev->attr.mode;
                        strcpy(attr->owner, dev->attr.owner);
                        strcpy(attr->group, dev->attr.group);
-                       /* FIXME  put the proper name here!!! */
-                       strcpy(attr->name, dev->attr.name);
-                       dbg("%s - owner = %s, group = %s, mode = %#o", dev->attr.name, dev->attr.owner, dev->attr.group, dev->attr.mode);
-                       goto exit;
-               }
+                       dbg("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
+                               dev->kernel_name, attr->name, 
+                               dev->attr.owner, dev->attr.group, dev->attr.mode);
+                       return retval;
+                       break;
+               default:
+                       dbg("Unknown type of device!");
+                       break;
+               }       
        }
        attr->mode = get_default_mode(class_dev);
        attr->owner[0] = 0x00;
index a26562342c018b7d7b7eab7b03f5bbaa4bbda0a1..de7a56119e91b65ab03c58bba2f1b26a0996d089 100644 (file)
@@ -18,4 +18,5 @@ TOPOLOGY, BUS="usb", place="2.2", NAME="mouse1"
 
 # ttyUSB1 should always be called visor
 REPLACE, KERNEL="ttyUSB1", NAME="visor"
+REPLACE, KERNEL="ttyUSB0", NAME="pl2303"