mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-08 16:11:26 +00:00
Fix support of multiple chips. Regression in 3.1.2, faulty commit is
r5792. Fixes ticket #2377. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5835 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
6c6376a12d
commit
d61b638245
2 files changed
+12
-8
No files matched your search
@@ -3,6 +3,7 @@ lm-sensors CHANGES file
|
||||
|
||||
SVN HEAD
|
||||
libsensors: Increase MAX_SENSORS_PER_TYPE to 24
|
||||
sensord: Fix support of multiple chips (#2377)
|
||||
sensors-detect: Give udev time to settle before accessing i2c nodes
|
||||
Add support for Intel PCH (SMBus)
|
||||
Add support for SMSC EMC1403 and EMC1404
|
||||
|
||||
+11
-8
@@ -137,9 +137,11 @@ static void rrdCheckLabel(const char *rawLabel, int index0)
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
const FeatureDescriptor *features = desc->features;
|
||||
@@ -147,7 +149,7 @@ static int _applyToFeatures(FeatureFN fn, void *data,
|
||||
const char *rawLabel;
|
||||
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;
|
||||
|
||||
@@ -158,11 +160,11 @@ static int _applyToFeatures(FeatureFN fn, void *data,
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static ChipDescriptor *lookup_known_chips(const sensors_chip_name *chip)
|
||||
@@ -184,7 +186,7 @@ static ChipDescriptor *lookup_known_chips(const sensors_chip_name *chip)
|
||||
|
||||
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;
|
||||
|
||||
@@ -197,9 +199,10 @@ static int applyToFeatures(FeatureFN fn, void *data)
|
||||
if (!desc)
|
||||
continue;
|
||||
|
||||
ret = _applyToFeatures(fn, data, chip, desc);
|
||||
if (ret)
|
||||
ret = _applyToFeatures(fn, data, chip, desc, labelOffset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
labelOffset += ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user