diff --git a/CHANGES b/CHANGES index fac2c575..ca8f51bb 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ SVN HEAD Add config-file scanner regression tests Add f71872f support Add w83627dhg support (David Holl, #2157) + Get the i2c adapter names from classdev.name Man page i2cdetect.8: Describe the output convention Man page sensors.1: Update (option -c) and clean up Module i2c-i801: Add ICH9 support diff --git a/lib/sysfs.c b/lib/sysfs.c index 20177a31..b2d06683 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -197,7 +197,11 @@ int sensors_read_sysfs_bus(void) if (!(dev = sysfs_get_classdev_device(clsdev))) continue; - if (!(attr = sysfs_get_device_attr(dev, "name"))) + /* Get the adapter name from the classdev "name" attribute + * (Linux 2.6.20 and later). If it fails, fall back to + * the device "name" attribute (for older kernels). */ + if (!(attr = sysfs_get_classdev_attr(clsdev, "name")) + && !(attr = sysfs_get_device_attr(dev, "name"))) continue; /* NB: attr->value[attr->len-1] == '\n'; chop that off */