mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 14:25:39 +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:
@@ -26,6 +26,7 @@
|
||||
#include "main.h"
|
||||
#include "chips.h"
|
||||
#include "lib/sensors.h"
|
||||
#include "lib/error.h"
|
||||
|
||||
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)) &&
|
||||
iter->mapping == feature->number) {
|
||||
int indx;
|
||||
int indx, err;
|
||||
|
||||
indx = iter->type - first_val - 1;
|
||||
if (indx < 0 || indx >= size)
|
||||
/* New feature in libsensors? Ignore. */
|
||||
continue;
|
||||
|
||||
if (sensors_get_value(name, iter->number, &feature_vals[indx]))
|
||||
printf("ERROR: Can't get %s data!\n", iter->name);
|
||||
err = sensors_get_value(name, iter->number, &feature_vals[indx]);
|
||||
if (err) {
|
||||
printf("ERROR: Can't get %s data: %s\n", iter->name,
|
||||
sensors_strerror(err));
|
||||
continue;
|
||||
}
|
||||
|
||||
has_features[indx] = 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user