From 2b650945f10c7571f41952455151deb0a726886c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 22 Oct 2007 18:27:04 +0000 Subject: [PATCH] sensors: Handle the case where voltage measurements aren't available. This will soon be the case of the Linux 2.6 gl518sm driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4977 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 34fe5fe6..aa4f26f7 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN HEAD sensord: Reload config on SIGHUP rather than automatically sensors: Fix file handle leak on library initialization error + Handle the case where voltage measurements aren't available sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips sensors-detect-stat.pl: Handle alternative chip lists diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 0c9f8e99..76d69394 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -287,7 +287,7 @@ static void print_chip_in(const sensors_chip_name *name, int label_size) { const sensors_subfeature *sf, *sfmin, *sfmax; - double val, alarm_max, alarm_min; + double alarm_max, alarm_min; char *label; if (!(label = sensors_get_label(name, feature))) { @@ -300,8 +300,10 @@ static void print_chip_in(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_INPUT); - val = sf ? get_value(name, sf) : 0; - printf("%+6.2f V", val); + if (sf) + printf("%+6.2f V", get_value(name, sf)); + else + printf(" N/A"); sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MIN);