56 lines
1.4 KiB
Diff
56 lines
1.4 KiB
Diff
|
Fix support of multiple chips.
|
||
|
|
||
|
Index: lm-sensors/prog/sensord/rrd.c
|
||
|
===================================================================
|
||
|
--- lm-sensors/prog/sensord/rrd.c (revision 5793)
|
||
|
+++ lm-sensors/prog/sensord/rrd.c (revision 5835)
|
||
|
@@ -138,7 +138,9 @@
|
||
|
}
|
||
|
|
||
|
+/* Returns the number of features processed, or -1 on error */
|
||
|
static int _applyToFeatures(FeatureFN fn, void *data,
|
||
|
const sensors_chip_name *chip,
|
||
|
- const ChipDescriptor *desc)
|
||
|
+ const ChipDescriptor *desc,
|
||
|
+ int labelOffset)
|
||
|
{
|
||
|
int i;
|
||
|
@@ -148,5 +150,5 @@
|
||
|
char *label;
|
||
|
|
||
|
- for (i = 0; i < MAX_RRD_SENSORS && features[i].format; ++i) {
|
||
|
+ for (i = 0; labelOffset + i < MAX_RRD_SENSORS && features[i].format; ++i) {
|
||
|
feature = features + i;
|
||
|
rawLabel = feature->feature->name;
|
||
|
@@ -159,9 +161,9 @@
|
||
|
}
|
||
|
|
||
|
- rrdCheckLabel(rawLabel, i);
|
||
|
- fn(data, rrdLabels[i], label, feature);
|
||
|
+ rrdCheckLabel(rawLabel, labelOffset + i);
|
||
|
+ fn(data, rrdLabels[labelOffset + i], label, feature);
|
||
|
free(label);
|
||
|
}
|
||
|
- return 0;
|
||
|
+ return i;
|
||
|
}
|
||
|
|
||
|
@@ -185,5 +187,5 @@
|
||
|
static int applyToFeatures(FeatureFN fn, void *data)
|
||
|
{
|
||
|
- int i, i_detected, ret;
|
||
|
+ int i, i_detected, ret, labelOffset = 0;
|
||
|
const sensors_chip_name *chip, *chip_arg;
|
||
|
ChipDescriptor *desc;
|
||
|
@@ -198,7 +200,8 @@
|
||
|
continue;
|
||
|
|
||
|
- ret = _applyToFeatures(fn, data, chip, desc);
|
||
|
- if (ret)
|
||
|
+ ret = _applyToFeatures(fn, data, chip, desc, labelOffset);
|
||
|
+ if (ret < 0)
|
||
|
return ret;
|
||
|
+ labelOffset += ret;
|
||
|
}
|
||
|
}
|