mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-19 19:40:49 +00:00
Better error handling when a feature value can't be read.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4822 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
afddd25552
commit
a46211007e
1 file changed
+8
-3
@@ -26,6 +26,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "chips.h"
|
#include "chips.h"
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
|
#include "lib/error.h"
|
||||||
|
|
||||||
void print_chip_raw(const sensors_chip_name *name)
|
void print_chip_raw(const sensors_chip_name *name)
|
||||||
{
|
{
|
||||||
@@ -77,15 +78,19 @@ static void sensors_get_available_features(const sensors_chip_name *name,
|
|||||||
|
|
||||||
while ((iter = sensors_get_all_features(name, &i)) &&
|
while ((iter = sensors_get_all_features(name, &i)) &&
|
||||||
iter->mapping == feature->number) {
|
iter->mapping == feature->number) {
|
||||||
int indx;
|
int indx, err;
|
||||||
|
|
||||||
indx = iter->type - first_val - 1;
|
indx = iter->type - first_val - 1;
|
||||||
if (indx < 0 || indx >= size)
|
if (indx < 0 || indx >= size)
|
||||||
/* New feature in libsensors? Ignore. */
|
/* New feature in libsensors? Ignore. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sensors_get_value(name, iter->number, &feature_vals[indx]))
|
err = sensors_get_value(name, iter->number, &feature_vals[indx]);
|
||||||
printf("ERROR: Can't get %s data!\n", iter->name);
|
if (err) {
|
||||||
|
printf("ERROR: Can't get %s data: %s\n", iter->name,
|
||||||
|
sensors_strerror(err));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
has_features[indx] = 1;
|
has_features[indx] = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user