- sysfs_device = sysfs_get_classdev_device(class_dev);
- if (sysfs_device != NULL) {
- printf("follow class device's \"device\" link '%s':\n", class_dev->path);
- printf(" BUS=\"%s\"\n", sysfs_device->bus);
- printf(" ID=\"%s\"\n", sysfs_device->bus_id);
+ 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);