- /* we only care about class devices and block stuff */
- if (!strstr(devpath, "class") &&
- !strstr(devpath, "block")) {
- info("not a block or class device");
- goto exit;
+ /* initialize the naming deamon */
+ udev_rules_init(&rules, 0);
+
+ /* fill in values and test_run flag*/
+ udev_init_device(&udev, devpath, subsystem, "add");
+
+ /* open the device */
+ snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath);
+ path[sizeof(path)-1] = '\0';
+ class_dev = sysfs_open_class_device_path(path);
+ if (class_dev == NULL) {
+ info("sysfs_open_class_device_path failed");
+ return 1;