- /* open sysfs class device directory and print all attributes */
- printf(" looking at class device '%s':\n", class_dev->path);
- if (print_all_attributes(class_dev->path) != 0) {
- printf("couldn't open class device directory\n");
- retval = -1;
- goto exit;
- }
-
- /* get the device link (if parent exists look here) */
- class_dev_parent = sysfs_get_classdev_parent(class_dev);
- if (class_dev_parent != NULL)
- sysfs_dev = sysfs_get_classdev_device(class_dev_parent);
- else
- sysfs_dev = sysfs_get_classdev_device(class_dev);
-
- if (sysfs_dev != NULL)
- printf("follow the class device's \"device\"\n");
-
- /* look the device chain upwards */
- while (sysfs_dev != NULL) {
- printf(" looking at the device chain at '%s':\n", sysfs_dev->path);
- printf(" BUS=\"%s\"\n", sysfs_dev->bus);
- printf(" ID=\"%s\"\n", sysfs_dev->bus_id);
-
- /* open sysfs device directory and print all attributes */
- print_all_attributes(sysfs_dev->path);
-
- sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev);
- if (sysfs_dev_parent == NULL)