[Pkg-net-snmp-devel] Bug in reading lmsensors values

Jose Juan Iglesias Rebollo josejuan.ir at enreomania.es
Thu Feb 4 15:47:49 UTC 2010


Hi:

Maybe you know this already. I'll tell you just in case...

Snmpwalk does not show all the lmSensors I can see through the command
'sensors'. Debugging net-snmp sources I think I've found the
cause. It's got to do with "sensors_subfeature.mapping", in a line
modified by the patch 60_libsensors_api.patch. I've modified this
patch in this way:

Original patch:
-                if ((data->mode & SENSORS_MODE_R) &&
-                    (data->mapping == SENSORS_NO_MAPPING) &&
-                    !sensors_get_label(*chip, data->number, &label) &&
-                    !sensors_get_feature(*chip, data->number, &val)) {
+                if ((subfeature->flags & SENSORS_MODE_R) &&
+                    (subfeature->mapping == 0) &&
                                             ^
+                    (label = sensors_get_label(chip, feature)) &&
+                    !sensors_get_value(chip, subfeature->number, &val)) {

Patch modified:

-                if ((data->mode & SENSORS_MODE_R) &&
-                    (data->mapping == SENSORS_NO_MAPPING) &&
-                    !sensors_get_label(*chip, data->number, &label) &&
-                    !sensors_get_feature(*chip, data->number, &val)) {
+                if ((subfeature->flags & SENSORS_MODE_R) &&
+                    (subfeature->mapping == feature->number) &&
                                             ^-------------^
+                    (label = sensors_get_label(chip, feature)) &&
+                    !sensors_get_value(chip, subfeature->number, &val)) {

Comparing subfeature->mapping with 0 prevents subfeatures of features
beyond the first to be processed. I've tried with feature->number, but
don't know the best solution.

Regards.



More information about the Pkg-net-snmp-devel mailing list