diff --git a/lib/access.h b/lib/access.h index 60068b7c..d416ad3a 100644 --- a/lib/access.h +++ b/lib/access.h @@ -29,4 +29,6 @@ extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); +sensors_feature_type sensors_feature_get_type(const sensors_feature_data *feature); + #endif /* def LIB_SENSORS_ACCESS_H */ diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 046a9dfe..b5708b28 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -117,10 +117,12 @@ This structure is used when you want to get all features of a specific chip. int number; .br const char *name; +.br + sensors_feature_type type; .br int mapping; .br - int unused; + int compute_mapping; .br int mode; .br diff --git a/lib/sensors.h b/lib/sensors.h index 75fe5208..a3ddaa39 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -125,27 +125,6 @@ extern const sensors_chip_name *sensors_get_detected_chips(int *nr); mapping is available */ #define SENSORS_NO_MAPPING -1 -/* This structure is used when you want to get all features of a specific - chip. */ -typedef struct sensors_feature_data { - int number; - char *name; - int mapping; - int compute_mapping; - int mode; -} sensors_feature_data; - -/* This returns all features of a specific chip. They are returned in - bunches: everything with the same mapping is returned just after each - other, with the master feature in front (that feature does not map to - itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are - two internally used variables. Set both to zero to start again at the - begin of the list. If no more features are found NULL is returned. - Do not try to change the returned structure; you will corrupt internal - data structures. */ -extern const sensors_feature_data *sensors_get_all_features - (sensors_chip_name name, int *nr1,int *nr2); - /* This enum contains some "magic" used by sensors_read_dynamic_chip() from lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart, and sensor features which should not have a compute_mapping to @@ -186,8 +165,27 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_MAX_SUB_FEATURES = 22 } sensors_feature_type; -sensors_feature_type sensors_feature_get_type - (const sensors_feature_data *feature); +/* This structure is used when you want to get all features of a specific + chip. */ +typedef struct sensors_feature_data { + int number; + char *name; + sensors_feature_type type; + int mapping; + int compute_mapping; + int mode; +} sensors_feature_data; + +/* This returns all features of a specific chip. They are returned in + bunches: everything with the same mapping is returned just after each + other, with the master feature in front (that feature does not map to + itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are + two internally used variables. Set both to zero to start again at the + begin of the list. If no more features are found NULL is returned. + Do not try to change the returned structure; you will corrupt internal + data structures. */ +extern const sensors_feature_data *sensors_get_all_features + (sensors_chip_name name, int *nr1,int *nr2); #ifdef __cplusplus } diff --git a/lib/sysfs.c b/lib/sysfs.c index 0b7c52da..30356fee 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -148,6 +148,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* fill in the other feature members */ feature.data.number = i + 1; + feature.data.type = type; if ((type & 0x00FF) == 0) { /* main feature */ diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index b20d3a10..fb9f712f 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -46,13 +46,9 @@ static void sensors_get_available_features(const sensors_chip_name *name, while((iter = sensors_get_all_features(*name, &i, &j)) && iter->mapping != SENSORS_NO_MAPPING && iter->mapping == feature->number) { - sensors_feature_type type = sensors_feature_get_type(iter); int indx; - if (type == SENSORS_FEATURE_UNKNOWN) - continue; - - indx = type - first_val - 1; + indx = iter->type - first_val - 1; if (indx < 0 || indx >= size) { printf("ERROR: Bug in sensors: index out of bound"); return; @@ -345,7 +341,7 @@ void print_generic_chip(const sensors_chip_name *name) if (feature->mapping != SENSORS_NO_MAPPING) continue; - switch(sensors_feature_get_type(feature)) { + switch (feature->type) { case SENSORS_FEATURE_TEMP: print_generic_chip_temp(name, feature, i, j, label_size); break; case SENSORS_FEATURE_IN: