mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 14:25:39 +00:00
libsensors no longer returns ignored features so no need to check for
this in applications anymore. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4709 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -155,17 +155,14 @@ applyToFeatures
|
|||||||
int labelNumber = feature->dataNumbers[0];
|
int labelNumber = feature->dataNumbers[0];
|
||||||
const char *rawLabel = NULL;
|
const char *rawLabel = NULL;
|
||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
int valid = 0;
|
|
||||||
if (getValid (chip, labelNumber, &valid)) {
|
if (getRawLabel (chip, labelNumber, &rawLabel)) {
|
||||||
sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber);
|
|
||||||
ret = -1;
|
|
||||||
} else if (getRawLabel (chip, labelNumber, &rawLabel)) {
|
|
||||||
sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber);
|
sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else if (!(label = sensors_get_label (chip, labelNumber))) {
|
} else if (!(label = sensors_get_label (chip, labelNumber))) {
|
||||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber);
|
sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else if (valid) {
|
} else {
|
||||||
rrdCheckLabel (rawLabel, num);
|
rrdCheckLabel (rawLabel, num);
|
||||||
ret = fn (data, rrdLabels[num], label, feature);
|
ret = fn (data, rrdLabels[num], label, feature);
|
||||||
++ num;
|
++ num;
|
||||||
|
@@ -33,18 +33,6 @@
|
|||||||
#define DO_SET 2
|
#define DO_SET 2
|
||||||
#define DO_RRD 3
|
#define DO_RRD 3
|
||||||
|
|
||||||
int
|
|
||||||
getValid
|
|
||||||
(const sensors_chip_name *name, int feature, int *valid) {
|
|
||||||
int err;
|
|
||||||
err = sensors_get_ignored (name, feature);
|
|
||||||
if (err >= 0) {
|
|
||||||
*valid = err;
|
|
||||||
err = 0;
|
|
||||||
}
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getRawLabel
|
getRawLabel
|
||||||
(const sensors_chip_name *name, int feature, const char **label) {
|
(const sensors_chip_name *name, int feature, const char **label) {
|
||||||
@@ -95,17 +83,11 @@ readUnknownChip
|
|||||||
|
|
||||||
while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0, &index1)) != NULL)) {
|
while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0, &index1)) != NULL)) {
|
||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
int valid = 0;
|
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
if (getValid (chip, sensor->number, &valid)) {
|
if (!(label = sensors_get_label (chip, sensor->number))) {
|
||||||
sensorLog (LOG_ERR, "Error getting sensor validity: %s/%s", chip->prefix, sensor->name);
|
|
||||||
ret = 20;
|
|
||||||
} else if (!(label = sensors_get_label (chip, sensor->number))) {
|
|
||||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name);
|
sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name);
|
||||||
ret = 21;
|
ret = 21;
|
||||||
} else if (!valid) {
|
|
||||||
/* skip invalid */
|
|
||||||
} else if (!(sensor->mode & SENSORS_MODE_R)) {
|
} else if (!(sensor->mode & SENSORS_MODE_R)) {
|
||||||
sensorLog (LOG_INFO, "%s: %s", sensor->name, label);
|
sensorLog (LOG_INFO, "%s: %s", sensor->name, label);
|
||||||
} else if ((ret = sensors_get_value (chip, sensor->number, &value))) {
|
} else if ((ret = sensors_get_value (chip, sensor->number, &value))) {
|
||||||
@@ -154,17 +136,13 @@ doKnownChip
|
|||||||
int alarm = alarms & feature->alarmMask;
|
int alarm = alarms & feature->alarmMask;
|
||||||
int beep = beeps & feature->beepMask;
|
int beep = beeps & feature->beepMask;
|
||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
int valid = 0;
|
|
||||||
|
|
||||||
if ((action == DO_SCAN) && !alarm) {
|
if ((action == DO_SCAN) && !alarm) {
|
||||||
continue;
|
continue;
|
||||||
} else if (getValid (chip, labelNumber, &valid)) {
|
|
||||||
sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber);
|
|
||||||
ret = 22;
|
|
||||||
} else if (!(label = sensors_get_label (chip, labelNumber))) {
|
} else if (!(label = sensors_get_label (chip, labelNumber))) {
|
||||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber);
|
sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber);
|
||||||
ret = 22;
|
ret = 22;
|
||||||
} else if (valid) {
|
} else {
|
||||||
double values[MAX_DATA];
|
double values[MAX_DATA];
|
||||||
|
|
||||||
for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) {
|
for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) {
|
||||||
|
@@ -58,7 +58,6 @@ extern int unloadLib (void);
|
|||||||
|
|
||||||
/* from sense.c */
|
/* from sense.c */
|
||||||
|
|
||||||
extern int getValid (const sensors_chip_name *name, int feature, int *valid);
|
|
||||||
extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label);
|
extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label);
|
||||||
|
|
||||||
extern int readChips (void);
|
extern int readChips (void);
|
||||||
|
Reference in New Issue
Block a user