2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

sensors: add humidity data to output of sensors command

Patch provided by Iain Paton.



git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6070 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Guenter Roeck
2012-09-11 19:05:10 +00:00
parent aa504302de
commit 4726e44ab8
2 changed files with 25 additions and 0 deletions

View File

@@ -658,6 +658,27 @@ static void print_chip_vid(const sensors_chip_name *name,
free(label);
}
static void print_chip_humidity(const sensors_chip_name *name,
const sensors_feature *feature,
int label_size)
{
char *label;
const sensors_subfeature *subfeature;
double humidity;
subfeature = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_HUMIDITY_INPUT);
if (!subfeature)
return;
if ((label = sensors_get_label(name, feature))
&& !sensors_get_value(name, subfeature->number, &humidity)) {
print_label(label, label_size);
printf("%6.1f \%RH\n", humidity);
}
free(label);
}
static void print_chip_beep_enable(const sensors_chip_name *name,
const sensors_feature *feature,
int label_size)
@@ -792,6 +813,9 @@ void print_chip(const sensors_chip_name *name)
case SENSORS_FEATURE_INTRUSION:
print_chip_intrusion(name, feature, label_size);
break;
case SENSORS_FEATURE_HUMIDITY:
print_chip_humidity(name, feature, label_size);
break;
default:
continue;
}