- attr_list = sysfs_get_classdev_attributes(class_dev);
- if (attr_list == NULL) {
- fprintf(stderr, "couldn't open class device directory\n");
- retval = -1;
- goto exit;
- }
- print_all_attributes(attr_list);
-
- /* 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 \"device\"-link to the physical 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);
- printf(" DRIVER==\"%s\"\n", sysfs_dev->driver_name);
-
- attr_list = sysfs_get_device_attributes(sysfs_dev);
- if (attr_list != NULL)
- print_all_attributes(attr_list);
- else
- printf("\n");
+ printf(" looking at device '%s':\n", dev->devpath);
+ printf(" KERNEL==\"%s\"\n", dev->kernel_name);
+ printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem);
+ print_all_attributes(dev->devpath);