- udev.test_run = 1;
- if (udev.type == DEV_NET || udev.devt) {
- udev_rules_get_name(&rules, &udev, class_dev);
- udev_add_device(&udev, class_dev);
- } else
- info("only char and block devices with a dev-file are supported by this test program");
- sysfs_close_class_device(class_dev);
-
- return 0;
+ if (!force)
+ udev->test_run = 1;
+
+ setenv("DEVPATH", udev->dev->devpath, 1);
+ setenv("SUBSYSTEM", udev->dev->subsystem, 1);
+ setenv("ACTION", udev->action, 1);
+ import_uevent_var(udev->dev->devpath);
+
+ info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem);
+ retval = udev_device_event(&rules, udev);
+ if (retval == 0 && !udev->ignore_device && udev_run) {
+ struct name_entry *name_loop;
+
+ list_for_each_entry(name_loop, &udev->run_list, node) {
+ char program[PATH_SIZE];
+
+ strlcpy(program, name_loop->name, sizeof(program));
+ udev_rules_apply_format(udev, program, sizeof(program));
+ info("run: '%s'", program);
+ }
+ }
+ udev_device_cleanup(udev);
+
+exit:
+ udev_rules_cleanup(&rules);
+ sysfs_cleanup();
+ return rc;