2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

sensors: Better handling of the fault flags.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4910 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2007-09-30 17:56:19 +00:00
parent 647b47cb6a
commit e012d14d95
2 changed files with 18 additions and 13 deletions

View File

@@ -147,10 +147,6 @@ static void print_chip_temp(const sensors_chip_name *name,
print_label(label, label_size);
free(label);
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_TEMP_INPUT);
val = sf ? get_value(name, sf) : 0;
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_TEMP_ALARM);
alarm = sf && get_value(name, sf);
@@ -230,9 +226,15 @@ static void print_chip_temp(const sensors_chip_name *name,
if (sf && get_value(name, sf)) {
printf(" FAULT ");
} else {
if (fahrenheit)
val = deg_ctof(val);
printf("%+6.1f%s ", val, degstr);
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_TEMP_INPUT);
if (sf) {
val = get_value(name, sf);
if (fahrenheit)
val = deg_ctof(val);
printf("%+6.1f%s ", val, degstr);
} else
printf(" N/A ");
}
print_temp_limits(limit1, limit2, s1, s2, alarm);
@@ -350,7 +352,6 @@ static void print_chip_fan(const sensors_chip_name *name,
{
const sensors_subfeature *sf, *sfmin, *sfdiv;
char *label;
double val;
if (!(label = sensors_get_label(name, feature))) {
fprintf(stderr, "ERROR: Can't get label of feature %s!\n",
@@ -360,15 +361,18 @@ static void print_chip_fan(const sensors_chip_name *name,
print_label(label, label_size);
free(label);
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_INPUT);
val = sf ? get_value(name, sf) : 0;
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_FAULT);
if (sf && get_value(name, sf))
printf(" FAULT");
else
printf("%4.0f RPM", val);
else {
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_INPUT);
if (sf)
printf("%4.0f RPM", get_value(name, sf));
else
printf(" N/A");
}
sfmin = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_MIN);