- /* look for the 'dev' file */
- attr = sysfs_get_classdev_attr(class_dev, "dev");
- if (attr != NULL)
- printf("device '%s' has major:minor %s", class_dev->path, attr->value);
-
- /* open sysfs class device directory and print all attributes */
- printf(" looking at class device '%s':\n", class_dev->path);
- printf(" KERNEL==\"%s\"\n", class_dev->name);
- printf(" SUBSYSTEM==\"%s\"\n", class_dev->classname);
-
- 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);
+ printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem);
+ printf(" DRIVER==\"%s\"\n", dev->driver);
+ print_all_attributes(dev->devpath, "ATTR");