- strfieldcpy(udev->name, dev->name);
- strfieldcpy(udev->symlink, dev->symlink);
- dbg("found name, '%s' becomes '%s'", dev->kernel_name, udev->name);
-
+ /* check for matching sysfs pairs */
+ if (dev->sysfs_pair[0].file[0] != '\0') {
+ dbg("check " FIELD_SYSFS " pairs");
+ if (match_sysfs_pairs(dev, class_dev, sysfs_device) != 0) {
+ dbg(FIELD_SYSFS " is not matching");
+ goto try_parent;
+ } else {
+ dbg(FIELD_SYSFS " matches");
+ }
+ }
+
+ /* execute external program */
+ if (dev->program[0] != '\0') {
+ char program[PROGRAM_SIZE];
+
+ dbg("check " FIELD_PROGRAM);
+ strfieldcpy(program, dev->program);
+ apply_format(udev, program, sizeof(program), class_dev, sysfs_device);
+ if (execute_program(program, udev->program_result, NAME_SIZE) != 0) {
+ dbg(FIELD_PROGRAM " returned nonzero");
+ goto try_parent;
+ } else {
+ dbg(FIELD_PROGRAM " returned successful");
+ }
+ }
+
+ /* check for matching result of external program */
+ if (dev->result[0] != '\0') {
+ dbg("check for " FIELD_RESULT
+ " dev->result='%s', udev->program_result='%s'",
+ dev->result, udev->program_result);
+ if (strcmp_pattern(dev->result, udev->program_result) != 0) {
+ dbg(FIELD_RESULT " is not matching");
+ goto try_parent;
+ } else {
+ dbg(FIELD_RESULT " matches");
+ }
+ }
+
+ /* Yeah, we matched! */