- /* Yup, this rule belongs to us! */
- info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
- udev_rules_filename, dev->config_line, udev->kernel_name, dev->name);
- strfieldcpy(udev->name, dev->name);
- strfieldcpy(udev->symlink, dev->symlink);
- goto found;
+ /* get kernel number */
+ pos = class_dev->name + strlen(class_dev->name);
+ while (isdigit(*(pos-1)))
+ pos--;
+ strfieldcpy(udev->kernel_number, pos);
+ dbg("kernel_number='%s'", udev->kernel_number);
+
+ /* look for a matching rule to apply */
+ list_for_each_entry(dev, &config_device_list, node) {
+ dbg("process rule");
+ if (match_rule(dev, class_dev, udev, sysfs_device) == 0) {
+ if (dev->name[0] == '\0' && dev->symlink[0] == '\0') {
+ info("configured rule in '%s' at line %i applied, '%s' is ignored",
+ dev->config_file, dev->config_line, udev->kernel_name);
+ return -1;
+ }
+
+ if (dev->symlink[0] != '\0') {
+ char temp[NAME_MAX];
+
+ info("configured rule in '%s' at line %i applied, added symlink '%s'",
+ dev->config_file, dev->config_line, dev->symlink);
+ /* do not clobber dev */
+ strfieldcpy(temp, dev->symlink);
+ apply_format(udev, temp, sizeof(temp),
+ class_dev, sysfs_device);
+ strfieldcat(udev->symlink, temp);
+ strfieldcat(udev->symlink, " ");
+ }
+
+ if (dev->name[0] != '\0') {
+ info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
+ dev->config_file, dev->config_line, udev->kernel_name, dev->name);
+ strfieldcpy(udev->name, dev->name);
+ goto found;
+ }
+ }