diff --git a/README b/README index b4df41d7..800468cb 100644 --- a/README +++ b/README @@ -79,3 +79,9 @@ is copyright (c) 1995-1998 by Simon Vogl. See the individual files for more exact copyright information. This package may be distributed according to the GNU General Public License (GPL), as included in the file COPYING. + +Note that at this moment, libsensors falls under the GPL, not the LGPL. +In more human language, that means it is FORBIDDEN to link any application +to the library, even to the shared version, if the application itself +does not fall under the GPL. This will probably be changed in the future. +In the meantime, you will have to contact us first if you want to do this. diff --git a/lib/access.c b/lib/access.c index 4b602b6c..4c510943 100644 --- a/lib/access.c +++ b/lib/access.c @@ -172,7 +172,7 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result) sensors_lookup_feature_nr(name.prefix, main_feature->compute_mapping))) return -SENSORS_ERR_NO_ENTRY; - if (! (main_feature->mode && SENSORS_R)) + if (! (main_feature->mode && SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name,chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) { @@ -206,7 +206,7 @@ int sensors_set_feature(sensors_chip_name name, int feature, double value) return -SENSORS_ERR_WILDCARDS; if (! (featureptr = sensors_lookup_feature_nr(name.prefix,feature))) return -SENSORS_ERR_NO_ENTRY; - if (! (featureptr->mode && SENSORS_W)) + if (! (featureptr->mode && SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name,chip));) for (i = 0; !expr && (i < chip->computes_count); i++) @@ -249,3 +249,34 @@ const char *sensors_get_algorithm_name(int bus_nr) return sensors_proc_bus[i].algorithm; return NULL; } + +/* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */ +const sensors_feature_data *sensors_get_all_features (sensors_chip_name name, + int *nr1, int*nr2) +{ + sensors_chip_feature *feature_list; + int i; + + for (i = 0; sensors_chip_features_list[i].prefix; i++) + if (!strcmp(sensors_chip_features_list[i].prefix,name.prefix)) { + feature_list=sensors_chip_features_list[i].feature; + if (!*nr1 && !*nr2) { /* Return the first entry */ + if (!feature_list[0].name) /* The list may be empty */ + return NULL; + *nr1 = *nr2 = 1; + return (sensors_feature_data *) (feature_list + 0); + } + for ((*nr2)++; feature_list[*nr2-1].name; (*nr2)++) + if (feature_list[*nr2-1].logical_mapping == feature_list[*nr1-1].number) + return (sensors_feature_data *) (feature_list + *nr2 - 1); + for ((*nr1)++; feature_list[*nr1-1].name && + (feature_list[*nr1-1].logical_mapping != SENSORS_NO_MAPPING); + (*nr1)++); + *nr2 = *nr1; + if (! feature_list[*nr1-1].name) + return NULL; + return (sensors_feature_data *) (feature_list + *nr1 - 1); + } + return NULL; +} + diff --git a/lib/access.h b/lib/access.h index baa934ba..ae1d9f33 100644 --- a/lib/access.h +++ b/lib/access.h @@ -39,13 +39,6 @@ typedef struct sensors_chip_features { struct sensors_chip_feature *feature; } sensors_chip_features; -#define SENSORS_NO_RW 0 -#define SENSORS_R 1 -#define SENSORS_W 2 -#define SENSORS_RW 3 - -#define SENSORS_NO_MAPPING -1 - extern sensors_chip_features sensors_chip_features_list[]; /* Returns, one by one, a pointer to all sensor_chip structs of the diff --git a/lib/chips.c b/lib/chips.c index de510c34..ffe9680e 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -19,6 +19,7 @@ #include "chips.h" #include "access.h" +#include "sensors.h" #include "src/sensors.h" /* For each chip, a list of features; @@ -40,237 +41,243 @@ static sensors_chip_feature lm78_features[] = { { SENSORS_LM78_IN0, "in0", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN0, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN0, VALUE(3), 2 }, { SENSORS_LM78_IN1, "in1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN1, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN1, VALUE(3), 2 }, { SENSORS_LM78_IN2, "in2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN2, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN2, VALUE(3), 2 }, { SENSORS_LM78_IN3, "in3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN3, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN3, VALUE(3), 2 }, { SENSORS_LM78_IN4, "in4", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN4, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN4, VALUE(3), 2 }, { SENSORS_LM78_IN5, "in5", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN5, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN5, VALUE(3), 2 }, { SENSORS_LM78_IN6, "in6", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN6, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN6, VALUE(3), 2 }, { SENSORS_LM78_IN0_MIN, "in0_min", SENSORS_LM78_IN0, SENSORS_LM78_IN0, - SENSORS_RW, LM78_SYSCTL_IN0, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN0, VALUE(1), 2 }, { SENSORS_LM78_IN1_MIN, "in1_min", SENSORS_LM78_IN1, SENSORS_LM78_IN1, - SENSORS_RW, LM78_SYSCTL_IN1, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN1, VALUE(1), 2 }, { SENSORS_LM78_IN2_MIN, "in2_min", SENSORS_LM78_IN2, SENSORS_LM78_IN2, - SENSORS_RW, LM78_SYSCTL_IN2, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN2, VALUE(1), 2 }, { SENSORS_LM78_IN3_MIN, "in3_min", SENSORS_LM78_IN3, SENSORS_LM78_IN3, - SENSORS_RW, LM78_SYSCTL_IN3, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN3, VALUE(1), 2 }, { SENSORS_LM78_IN4_MIN, "in4_min", SENSORS_LM78_IN4, SENSORS_LM78_IN4, - SENSORS_RW, LM78_SYSCTL_IN4, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN4, VALUE(1), 2 }, { SENSORS_LM78_IN5_MIN, "in5_min", SENSORS_LM78_IN5, SENSORS_LM78_IN5, - SENSORS_RW, LM78_SYSCTL_IN5, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN5, VALUE(1), 2 }, { SENSORS_LM78_IN6_MIN, "in6_min", SENSORS_LM78_IN6, SENSORS_LM78_IN6, - SENSORS_RW, LM78_SYSCTL_IN6, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN6, VALUE(1), 2 }, { SENSORS_LM78_IN0_MAX, "in0_max", SENSORS_LM78_IN0, SENSORS_LM78_IN0, - SENSORS_RW, LM78_SYSCTL_IN0, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN0, VALUE(2), 2 }, { SENSORS_LM78_IN1_MAX, "in1_max", SENSORS_LM78_IN1, SENSORS_LM78_IN1, - SENSORS_RW, LM78_SYSCTL_IN1, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN1, VALUE(2), 2 }, { SENSORS_LM78_IN2_MAX, "in2_max", SENSORS_LM78_IN2, SENSORS_LM78_IN2, - SENSORS_RW, LM78_SYSCTL_IN2, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN2, VALUE(2), 2 }, { SENSORS_LM78_IN3_MAX, "in3_max", SENSORS_LM78_IN3, SENSORS_LM78_IN3, - SENSORS_RW, LM78_SYSCTL_IN3, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN3, VALUE(2), 2 }, { SENSORS_LM78_IN4_MAX, "in4_max", SENSORS_LM78_IN4, SENSORS_LM78_IN4, - SENSORS_RW, LM78_SYSCTL_IN4, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN4, VALUE(2), 2 }, { SENSORS_LM78_IN5_MAX, "in5_max", SENSORS_LM78_IN5, SENSORS_LM78_IN5, - SENSORS_RW, LM78_SYSCTL_IN5, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN5, VALUE(2), 2 }, { SENSORS_LM78_IN6_MAX, "in6_max", SENSORS_LM78_IN6, SENSORS_LM78_IN6, - SENSORS_RW, LM78_SYSCTL_IN6, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN6, VALUE(2), 2 }, { SENSORS_LM78_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN1, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN1, VALUE(2), 0 }, { SENSORS_LM78_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN2, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN2, VALUE(2), 0 }, { SENSORS_LM78_FAN3, "fan3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN3, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN3, VALUE(2), 0 }, { SENSORS_LM78_FAN1_MIN, "fan1_min", SENSORS_LM78_FAN1, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN1, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN1, VALUE(1), 0 }, { SENSORS_LM78_FAN2_MIN, "fan2_min", SENSORS_LM78_FAN2, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN2, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN2, VALUE(1), 0 }, { SENSORS_LM78_FAN3_MIN, "fan3_min", SENSORS_LM78_FAN3, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN3, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN3, VALUE(1), 0 }, { SENSORS_LM78_TEMP, "temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_TEMP, VALUE(3), 1 }, + SENSORS_MODE_R, LM78_SYSCTL_TEMP, VALUE(3), 1 }, { SENSORS_LM78_TEMP_HYST, "temp_hyst", SENSORS_LM78_TEMP, - SENSORS_LM78_TEMP, SENSORS_RW, LM78_SYSCTL_TEMP, - VALUE(2), 1 }, + SENSORS_LM78_TEMP, SENSORS_MODE_RW, + LM78_SYSCTL_TEMP, VALUE(2), 1 }, { SENSORS_LM78_TEMP_OVER, "temp_over", SENSORS_LM78_TEMP, - SENSORS_LM78_TEMP, SENSORS_RW, LM78_SYSCTL_TEMP, - VALUE(1), 1 }, + SENSORS_LM78_TEMP, SENSORS_MODE_RW, + LM78_SYSCTL_TEMP, VALUE(1), 1 }, { SENSORS_LM78_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_VID, VALUE(1), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_VID, VALUE(1), 2 }, { SENSORS_LM78_FAN1_DIV, "fan1_div", SENSORS_LM78_FAN1, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN_DIV, VALUE(1), + 0 }, { SENSORS_LM78_FAN2_DIV, "fan2_div", SENSORS_LM78_FAN2, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN_DIV, VALUE(2), + 0 }, { SENSORS_LM78_FAN3_DIV, "fan3_div", SENSORS_LM78_FAN3, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN_DIV, VALUE(3), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN_DIV, VALUE(3), + 0 }, { SENSORS_LM78_ALARMS, "alarms", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_ALARMS, VALUE(1), 0 }, { 0 } }; static sensors_chip_feature lm78j_features[] = { { SENSORS_LM78J_IN0, "in0", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN0, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN0, VALUE(3), 2 }, { SENSORS_LM78J_IN1, "in1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN1, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN1, VALUE(3), 2 }, { SENSORS_LM78J_IN2, "in2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN2, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN2, VALUE(3), 2 }, { SENSORS_LM78J_IN3, "in3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN3, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN3, VALUE(3), 2 }, { SENSORS_LM78J_IN4, "in4", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN4, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN4, VALUE(3), 2 }, { SENSORS_LM78J_IN5, "in5", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN5, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN5, VALUE(3), 2 }, { SENSORS_LM78J_IN6, "in6", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN6, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN6, VALUE(3), 2 }, { SENSORS_LM78J_IN0_MIN, "in0_min", SENSORS_LM78J_IN0, SENSORS_LM78J_IN0, - SENSORS_RW, LM78_SYSCTL_IN0, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN0, VALUE(1), 2 }, { SENSORS_LM78J_IN1_MIN, "in1_min", SENSORS_LM78J_IN1, SENSORS_LM78J_IN1, - SENSORS_RW, LM78_SYSCTL_IN1, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN1, VALUE(1), 2 }, { SENSORS_LM78J_IN2_MIN, "in2_min", SENSORS_LM78J_IN2, SENSORS_LM78J_IN2, - SENSORS_RW, LM78_SYSCTL_IN2, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN2, VALUE(1), 2 }, { SENSORS_LM78J_IN3_MIN, "in3_min", SENSORS_LM78J_IN3, SENSORS_LM78J_IN3, - SENSORS_RW, LM78_SYSCTL_IN3, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN3, VALUE(1), 2 }, { SENSORS_LM78J_IN4_MIN, "in4_min", SENSORS_LM78J_IN4, SENSORS_LM78J_IN4, - SENSORS_RW, LM78_SYSCTL_IN4, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN4, VALUE(1), 2 }, { SENSORS_LM78J_IN5_MIN, "in5_min", SENSORS_LM78J_IN5, SENSORS_LM78J_IN5, - SENSORS_RW, LM78_SYSCTL_IN5, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN5, VALUE(1), 2 }, { SENSORS_LM78J_IN6_MIN, "in6_min", SENSORS_LM78J_IN6, SENSORS_LM78J_IN6, - SENSORS_RW, LM78_SYSCTL_IN6, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN6, VALUE(1), 2 }, { SENSORS_LM78J_IN0_MAX, "in0_max", SENSORS_LM78J_IN0, SENSORS_LM78J_IN0, - SENSORS_RW, LM78_SYSCTL_IN0, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN0, VALUE(2), 2 }, { SENSORS_LM78J_IN1_MAX, "in1_max", SENSORS_LM78J_IN1, SENSORS_LM78J_IN1, - SENSORS_RW, LM78_SYSCTL_IN1, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN1, VALUE(2), 2 }, { SENSORS_LM78J_IN2_MAX, "in2_max", SENSORS_LM78J_IN2, SENSORS_LM78J_IN2, - SENSORS_RW, LM78_SYSCTL_IN2, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN2, VALUE(2), 2 }, { SENSORS_LM78J_IN3_MAX, "in3_max", SENSORS_LM78J_IN3, SENSORS_LM78J_IN3, - SENSORS_RW, LM78_SYSCTL_IN3, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN3, VALUE(2), 2 }, { SENSORS_LM78J_IN4_MAX, "in4_max", SENSORS_LM78J_IN4, SENSORS_LM78J_IN4, - SENSORS_RW, LM78_SYSCTL_IN4, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN4, VALUE(2), 2 }, { SENSORS_LM78J_IN5_MAX, "in5_max", SENSORS_LM78J_IN5, SENSORS_LM78J_IN5, - SENSORS_RW, LM78_SYSCTL_IN5, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN5, VALUE(2), 2 }, { SENSORS_LM78J_IN6_MAX, "in6_max", SENSORS_LM78J_IN6, SENSORS_LM78J_IN6, - SENSORS_RW, LM78_SYSCTL_IN6, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN6, VALUE(2), 2 }, { SENSORS_LM78J_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN1, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN1, VALUE(2), 0 }, { SENSORS_LM78J_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN2, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN2, VALUE(2), 0 }, { SENSORS_LM78J_FAN3, "fan3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN3, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN3, VALUE(2), 0 }, { SENSORS_LM78J_FAN1_MIN, "fan1_min", SENSORS_LM78J_FAN1, - SENSORS_NO_MAPPING, SENSORS_RW, LM78_SYSCTL_FAN1, - VALUE(1), 0 }, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, + LM78_SYSCTL_FAN1, VALUE(1), 0 }, { SENSORS_LM78J_FAN2_MIN, "fan2_min", SENSORS_LM78J_FAN2, - SENSORS_NO_MAPPING, SENSORS_RW, LM78_SYSCTL_FAN2, - VALUE(1), 0 }, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, + LM78_SYSCTL_FAN2, VALUE(1), 0 }, { SENSORS_LM78J_FAN3_MIN, "fan3_min", SENSORS_LM78J_FAN3, - SENSORS_NO_MAPPING, SENSORS_RW, LM78_SYSCTL_FAN3, - VALUE(1), 0 }, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, + LM78_SYSCTL_FAN3, VALUE(1), 0 }, { SENSORS_LM78J_TEMP, "temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_TEMP, VALUE(3), 1 }, + SENSORS_MODE_R, LM78_SYSCTL_TEMP, VALUE(3), 1 }, { SENSORS_LM78J_TEMP_HYST, "temp_hyst", SENSORS_LM78J_TEMP, - SENSORS_LM78J_TEMP, SENSORS_RW, LM78_SYSCTL_TEMP, - VALUE(2), 1 }, + SENSORS_LM78J_TEMP, SENSORS_MODE_RW, + LM78_SYSCTL_TEMP, VALUE(2), 1 }, { SENSORS_LM78J_TEMP_OVER, "temp_over", SENSORS_LM78J_TEMP, - SENSORS_LM78J_TEMP, SENSORS_RW, LM78_SYSCTL_TEMP, - VALUE(1), 1 }, + SENSORS_LM78J_TEMP, SENSORS_MODE_RW, + LM78_SYSCTL_TEMP, VALUE(1), 1 }, { SENSORS_LM78J_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_VID, VALUE(1), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_VID, VALUE(1), 2 }, { SENSORS_LM78J_FAN1_DIV, "fan1_div", SENSORS_LM78J_FAN1, - SENSORS_NO_MAPPING, SENSORS_RW, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, { SENSORS_LM78J_FAN2_DIV, "fan2_div", SENSORS_LM78J_FAN2, - SENSORS_NO_MAPPING, SENSORS_RW, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, { SENSORS_LM78J_FAN3_DIV, "fan3_div", SENSORS_LM78J_FAN3, - SENSORS_NO_MAPPING, SENSORS_R, + SENSORS_NO_MAPPING, SENSORS_MODE_R, LM78_SYSCTL_FAN_DIV, VALUE(3), 0 }, { SENSORS_LM78J_ALARMS, "alarms", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_ALARMS, VALUE(1), 0 }, { 0 } }; static sensors_chip_feature lm79_features[] = { { SENSORS_LM79_IN0, "in0", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN0, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN0, VALUE(3), 2 }, { SENSORS_LM79_IN1, "in1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN1, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN1, VALUE(3), 2 }, { SENSORS_LM79_IN2, "in2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN2, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN2, VALUE(3), 2 }, { SENSORS_LM79_IN3, "in3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN3, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN3, VALUE(3), 2 }, { SENSORS_LM79_IN4, "in4", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN4, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN4, VALUE(3), 2 }, { SENSORS_LM79_IN5, "in5", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN5, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN5, VALUE(3), 2 }, { SENSORS_LM79_IN6, "in6", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_IN6, VALUE(3), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_IN6, VALUE(3), 2 }, { SENSORS_LM79_IN0_MIN, "in0_min", SENSORS_LM79_IN0, SENSORS_LM79_IN0, - SENSORS_RW, LM78_SYSCTL_IN0, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN0, VALUE(1), 2 }, { SENSORS_LM79_IN1_MIN, "in1_min", SENSORS_LM79_IN1, SENSORS_LM79_IN1, - SENSORS_RW, LM78_SYSCTL_IN1, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN1, VALUE(1), 2 }, { SENSORS_LM79_IN2_MIN, "in2_min", SENSORS_LM79_IN2, SENSORS_LM79_IN2, - SENSORS_RW, LM78_SYSCTL_IN2, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN2, VALUE(1), 2 }, { SENSORS_LM79_IN3_MIN, "in3_min", SENSORS_LM79_IN3, SENSORS_LM79_IN3, - SENSORS_RW, LM78_SYSCTL_IN3, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN3, VALUE(1), 2 }, { SENSORS_LM79_IN4_MIN, "in4_min", SENSORS_LM79_IN4, SENSORS_LM79_IN4, - SENSORS_RW, LM78_SYSCTL_IN4, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN4, VALUE(1), 2 }, { SENSORS_LM79_IN5_MIN, "in5_min", SENSORS_LM79_IN5, SENSORS_LM79_IN5, - SENSORS_RW, LM78_SYSCTL_IN5, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN5, VALUE(1), 2 }, { SENSORS_LM79_IN6_MIN, "in6_min", SENSORS_LM79_IN6, SENSORS_LM79_IN6, - SENSORS_RW, LM78_SYSCTL_IN6, VALUE(1), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN6, VALUE(1), 2 }, { SENSORS_LM79_IN0_MAX, "in0_max", SENSORS_LM79_IN0, SENSORS_LM79_IN0, - SENSORS_RW, LM78_SYSCTL_IN0, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN0, VALUE(2), 2 }, { SENSORS_LM79_IN1_MAX, "in1_max", SENSORS_LM79_IN1, SENSORS_LM79_IN1, - SENSORS_RW, LM78_SYSCTL_IN1, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN1, VALUE(2), 2 }, { SENSORS_LM79_IN2_MAX, "in2_max", SENSORS_LM79_IN2, SENSORS_LM79_IN2, - SENSORS_RW, LM78_SYSCTL_IN2, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN2, VALUE(2), 2 }, { SENSORS_LM79_IN3_MAX, "in3_max", SENSORS_LM79_IN3, SENSORS_LM79_IN3, - SENSORS_RW, LM78_SYSCTL_IN3, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN3, VALUE(2), 2 }, { SENSORS_LM79_IN4_MAX, "in4_max", SENSORS_LM79_IN4, SENSORS_LM79_IN4, - SENSORS_RW, LM78_SYSCTL_IN4, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN4, VALUE(2), 2 }, { SENSORS_LM79_IN5_MAX, "in5_max", SENSORS_LM79_IN5, SENSORS_LM79_IN5, - SENSORS_RW, LM78_SYSCTL_IN5, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN5, VALUE(2), 2 }, { SENSORS_LM79_IN6_MAX, "in6_max", SENSORS_LM79_IN6, SENSORS_LM79_IN6, - SENSORS_RW, LM78_SYSCTL_IN6, VALUE(2), 2 }, + SENSORS_MODE_RW, LM78_SYSCTL_IN6, VALUE(2), 2 }, { SENSORS_LM79_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN1, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN1, VALUE(2), 0 }, { SENSORS_LM79_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN2, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN2, VALUE(2), 0 }, { SENSORS_LM79_FAN3, "fan3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN3, VALUE(2), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN3, VALUE(2), 0 }, { SENSORS_LM79_FAN1_MIN, "fan1_min", SENSORS_LM79_FAN1, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN1, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN1, VALUE(1), 0 }, { SENSORS_LM79_FAN2_MIN, "fan2_min", SENSORS_LM79_FAN2, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN2, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN2, VALUE(1), 0 }, { SENSORS_LM79_FAN3_MIN, "fan3_min", SENSORS_LM79_FAN3, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN3, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN3, VALUE(1), 0 }, { SENSORS_LM79_TEMP, "temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_TEMP, VALUE(3), 1 }, + SENSORS_MODE_R, LM78_SYSCTL_TEMP, VALUE(3), 1 }, { SENSORS_LM79_TEMP_HYST, "temp_hyst", SENSORS_LM79_TEMP, - SENSORS_LM79_TEMP, SENSORS_RW, LM78_SYSCTL_TEMP, - VALUE(2), 1 }, + SENSORS_LM79_TEMP, SENSORS_MODE_RW, + LM78_SYSCTL_TEMP, VALUE(2), 1 }, { SENSORS_LM79_TEMP_OVER, "temp_over", SENSORS_LM79_TEMP, - SENSORS_LM79_TEMP, SENSORS_RW, LM78_SYSCTL_TEMP, - VALUE(1), 1 }, + SENSORS_LM79_TEMP, SENSORS_MODE_RW, + LM78_SYSCTL_TEMP, VALUE(1), 1 }, { SENSORS_LM79_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_VID, VALUE(1), 2 }, + SENSORS_MODE_R, LM78_SYSCTL_VID, VALUE(1), 2 }, { SENSORS_LM79_FAN1_DIV, "fan1_div", SENSORS_LM79_FAN1, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN_DIV, VALUE(1), + 0 }, { SENSORS_LM79_FAN2_DIV, "fan2_div", SENSORS_LM79_FAN2, SENSORS_NO_MAPPING, - SENSORS_RW, LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, + SENSORS_MODE_RW, LM78_SYSCTL_FAN_DIV, VALUE(2), + 0 }, { SENSORS_LM79_FAN3_DIV, "fan3_div", SENSORS_LM79_FAN3, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_FAN_DIV, VALUE(3), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_FAN_DIV, VALUE(3), + 0 }, { SENSORS_LM79_ALARMS, "alarms", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + SENSORS_MODE_R, LM78_SYSCTL_ALARMS, VALUE(1), 0 }, { 0 } }; @@ -278,78 +285,80 @@ static sensors_chip_feature lm79_features[] = static sensors_chip_feature lm75_features[] = { { SENSORS_LM75_TEMP, "temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, LM75_SYSCTL_TEMP, VALUE(3), 1 }, + SENSORS_MODE_R, LM75_SYSCTL_TEMP, VALUE(3), 1 }, { SENSORS_LM75_TEMP_HYST, "temp_hyst", SENSORS_LM75_TEMP, - SENSORS_LM75_TEMP, SENSORS_RW, LM75_SYSCTL_TEMP, - VALUE(2), 1 }, + SENSORS_LM75_TEMP, SENSORS_MODE_RW, + LM75_SYSCTL_TEMP, VALUE(2), 1 }, { SENSORS_LM75_TEMP_OVER, "temp_over", SENSORS_LM75_TEMP, - SENSORS_LM75_TEMP, SENSORS_RW, LM75_SYSCTL_TEMP, - VALUE(1), 1 }, + SENSORS_LM75_TEMP, SENSORS_MODE_RW, + LM75_SYSCTL_TEMP, VALUE(1), 1 }, { 0 } }; static sensors_chip_feature gl518r00_features[] = { { SENSORS_GL518R00_VDD, "vdd", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_NO_RW, GL518_SYSCTL_VDD, VALUE(3), 2 }, + SENSORS_MODE_NO_RW, GL518_SYSCTL_VDD, VALUE(3), 2 }, { SENSORS_GL518R00_VIN1, "vin1", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_NO_RW, GL518_SYSCTL_VIN1, VALUE(3), 2 }, + SENSORS_MODE_NO_RW, GL518_SYSCTL_VIN1, VALUE(3), + 2 }, { SENSORS_GL518R00_VIN2, "vin2", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_NO_RW, GL518_SYSCTL_VIN2, VALUE(3), 2 }, + SENSORS_MODE_NO_RW, GL518_SYSCTL_VIN2, VALUE(3), + 2 }, { SENSORS_GL518R00_VIN3, "vin3", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_VIN3, VALUE(3), 2 }, + SENSORS_MODE_R, GL518_SYSCTL_VIN3, VALUE(3), 2 }, { SENSORS_GL518R00_VDD_MIN, "vdd_min", SENSORS_GL518R00_VDD, - SENSORS_GL518R00_VDD, SENSORS_RW, + SENSORS_GL518R00_VDD, SENSORS_MODE_RW, GL518_SYSCTL_VDD, VALUE(1), 2 }, { SENSORS_GL518R00_VIN1_MIN, "vin1_min", SENSORS_GL518R00_VIN1, - SENSORS_GL518R00_VIN1, SENSORS_RW, + SENSORS_GL518R00_VIN1, SENSORS_MODE_RW, GL518_SYSCTL_VIN1, VALUE(1), 2 }, { SENSORS_GL518R00_VIN2_MIN, "vin2_min", SENSORS_GL518R00_VIN2, - SENSORS_GL518R00_VIN2, SENSORS_RW, + SENSORS_GL518R00_VIN2, SENSORS_MODE_RW, GL518_SYSCTL_VIN2, VALUE(1), 2 }, { SENSORS_GL518R00_VIN3_MIN, "vin3_min", SENSORS_GL518R00_VIN3, - SENSORS_GL518R00_VIN3, SENSORS_RW, + SENSORS_GL518R00_VIN3, SENSORS_MODE_RW, GL518_SYSCTL_VIN3, VALUE(1), 2 }, { SENSORS_GL518R00_VDD_MAX, "vdd_max", SENSORS_GL518R00_VDD, - SENSORS_GL518R00_VDD, SENSORS_RW, + SENSORS_GL518R00_VDD, SENSORS_MODE_RW, GL518_SYSCTL_VDD, VALUE(2), 2 }, { SENSORS_GL518R00_VIN1_MAX, "vin1_max", SENSORS_GL518R00_VIN1, - SENSORS_GL518R00_VIN1, SENSORS_RW, + SENSORS_GL518R00_VIN1, SENSORS_MODE_RW, GL518_SYSCTL_VIN1, VALUE(2), 2 }, { SENSORS_GL518R00_VIN2_MAX, "vin2_max", SENSORS_GL518R00_VIN2, - SENSORS_GL518R00_VIN2, SENSORS_RW, + SENSORS_GL518R00_VIN2, SENSORS_MODE_RW, GL518_SYSCTL_VIN2, VALUE(2), 2 }, { SENSORS_GL518R00_VIN3_MAX, "vin3_max", SENSORS_GL518R00_VIN3, - SENSORS_GL518R00_VIN3, SENSORS_RW, + SENSORS_GL518R00_VIN3, SENSORS_MODE_RW, GL518_SYSCTL_VIN3, VALUE(2), 2 }, { SENSORS_GL518R00_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_FAN1, VALUE(2), 0 }, + SENSORS_MODE_R, GL518_SYSCTL_FAN1, VALUE(2), 0 }, { SENSORS_GL518R00_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_FAN2, VALUE(2), 0 }, + SENSORS_MODE_R, GL518_SYSCTL_FAN2, VALUE(2), 0 }, { SENSORS_GL518R00_FAN1_MIN, "fan1_min", SENSORS_GL518R00_FAN1, - SENSORS_GL518R00_FAN1, SENSORS_RW, + SENSORS_GL518R00_FAN1, SENSORS_MODE_RW, GL518_SYSCTL_FAN1, VALUE(1), 0 }, { SENSORS_GL518R00_FAN2_MIN, "fan2_min", SENSORS_GL518R00_FAN2, - SENSORS_GL518R00_FAN2, SENSORS_RW, + SENSORS_GL518R00_FAN2, SENSORS_MODE_RW, GL518_SYSCTL_FAN2, VALUE(1), 0 }, { SENSORS_GL518R00_TEMP, "temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_TEMP, VALUE(3), 1 }, + SENSORS_MODE_R, GL518_SYSCTL_TEMP, VALUE(3), 1 }, { SENSORS_GL518R00_TEMP_HYST, "temp_hyst", SENSORS_GL518R00_TEMP, - SENSORS_GL518R00_TEMP, SENSORS_RW, + SENSORS_GL518R00_TEMP, SENSORS_MODE_RW, GL518_SYSCTL_TEMP, VALUE(2), 1 }, { SENSORS_GL518R00_TEMP_OVER, "temp_over", SENSORS_GL518R00_TEMP, - SENSORS_GL518R00_TEMP, SENSORS_RW, + SENSORS_GL518R00_TEMP, SENSORS_MODE_RW, GL518_SYSCTL_VDD, VALUE(1), 1 }, { SENSORS_GL518R00_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_VID, VALUE(1), 0 }, + SENSORS_MODE_R, GL518_SYSCTL_VID, VALUE(1), 0 }, { SENSORS_GL518R00_FAN1_DIV, "fan1_div", SENSORS_GL518R00_FAN1, - SENSORS_NO_MAPPING, SENSORS_RW, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, GL518_SYSCTL_FAN_DIV, VALUE(1), 0 }, { SENSORS_GL518R00_FAN2_DIV, "fan2_div", SENSORS_GL518R00_FAN2, - SENSORS_NO_MAPPING, SENSORS_RW, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, GL518_SYSCTL_FAN_DIV, VALUE(2), 0 }, { SENSORS_GL518R00_ALARMS, "alarms", SENSORS_NO_MAPPING, - SENSORS_NO_MAPPING, SENSORS_R, + SENSORS_NO_MAPPING, SENSORS_MODE_R, GL518_SYSCTL_FAN_DIV, VALUE(3), 0 }, { 0 } }; @@ -358,65 +367,67 @@ static sensors_chip_feature gl518r00_features[] = static sensors_chip_feature gl518r80_features[] = { { SENSORS_GL518R80_VDD, "vdd", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_NO_RW, GL518_SYSCTL_VDD, VALUE(3), 2 }, + SENSORS_MODE_NO_RW, GL518_SYSCTL_VDD, VALUE(3), 2 }, { SENSORS_GL518R80_VIN1, "vin1", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_NO_RW, GL518_SYSCTL_VIN1, VALUE(3), 2 }, + SENSORS_MODE_NO_RW, GL518_SYSCTL_VIN1, VALUE(3), + 2 }, { SENSORS_GL518R80_VIN2, "vin2", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_NO_RW, GL518_SYSCTL_VIN2, VALUE(3), 2 }, + SENSORS_MODE_NO_RW, GL518_SYSCTL_VIN2, VALUE(3), + 2 }, { SENSORS_GL518R80_VIN3, "vin3", SENSORS_NO_MAPPING,SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_VIN3, VALUE(3), 2 }, + SENSORS_MODE_R, GL518_SYSCTL_VIN3, VALUE(3), 2 }, { SENSORS_GL518R80_VDD_MIN, "vdd_min", SENSORS_GL518R80_VDD, - SENSORS_GL518R80_VDD, SENSORS_RW, + SENSORS_GL518R80_VDD, SENSORS_MODE_RW, GL518_SYSCTL_VDD, VALUE(1), 2 }, { SENSORS_GL518R80_VIN1_MIN, "vin1_min", SENSORS_GL518R80_VIN1, - SENSORS_GL518R80_VIN1, SENSORS_RW, + SENSORS_GL518R80_VIN1, SENSORS_MODE_RW, GL518_SYSCTL_VIN1, VALUE(1), 2 }, { SENSORS_GL518R80_VIN2_MIN, "vin2_min", SENSORS_GL518R80_VIN2, - SENSORS_GL518R80_VIN2, SENSORS_RW, + SENSORS_GL518R80_VIN2, SENSORS_MODE_RW, GL518_SYSCTL_VIN2, VALUE(1), 2 }, { SENSORS_GL518R80_VIN3_MIN, "vin3_min", SENSORS_GL518R80_VIN3, - SENSORS_GL518R80_VIN3, SENSORS_RW, + SENSORS_GL518R80_VIN3, SENSORS_MODE_RW, GL518_SYSCTL_VIN3, VALUE(1), 2 }, { SENSORS_GL518R80_VDD_MAX, "vdd_max", SENSORS_GL518R80_VDD, - SENSORS_GL518R80_VDD, SENSORS_RW, + SENSORS_GL518R80_VDD, SENSORS_MODE_RW, GL518_SYSCTL_VDD, VALUE(2), 2 }, { SENSORS_GL518R80_VIN1_MAX, "vin1_max", SENSORS_GL518R80_VIN1, - SENSORS_GL518R80_VIN1, SENSORS_RW, + SENSORS_GL518R80_VIN1, SENSORS_MODE_RW, GL518_SYSCTL_VIN1, VALUE(2), 2 }, { SENSORS_GL518R80_VIN2_MAX, "vin2_max", SENSORS_GL518R80_VIN2, - SENSORS_GL518R80_VIN2, SENSORS_RW, + SENSORS_GL518R80_VIN2, SENSORS_MODE_RW, GL518_SYSCTL_VIN2, VALUE(2), 2 }, { SENSORS_GL518R80_VIN3_MAX, "vin3_max", SENSORS_GL518R80_VIN3, - SENSORS_GL518R80_VIN3, SENSORS_RW, + SENSORS_GL518R80_VIN3, SENSORS_MODE_RW, GL518_SYSCTL_VIN3, VALUE(2), 2 }, { SENSORS_GL518R80_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_FAN1, VALUE(2), 0 }, + SENSORS_MODE_R, GL518_SYSCTL_FAN1, VALUE(2), 0 }, { SENSORS_GL518R80_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_FAN2, VALUE(2), 0 }, + SENSORS_MODE_R, GL518_SYSCTL_FAN2, VALUE(2), 0 }, { SENSORS_GL518R80_FAN1_MIN, "fan1_min", SENSORS_GL518R80_FAN1, - SENSORS_GL518R80_FAN1, SENSORS_RW, + SENSORS_GL518R80_FAN1, SENSORS_MODE_RW, GL518_SYSCTL_FAN1, VALUE(1), 0 }, { SENSORS_GL518R80_FAN2_MIN, "fan2_min", SENSORS_GL518R80_FAN2, - SENSORS_GL518R80_FAN2, SENSORS_RW, + SENSORS_GL518R80_FAN2, SENSORS_MODE_RW, GL518_SYSCTL_FAN2, VALUE(1), 0 }, { SENSORS_GL518R80_TEMP, "temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_TEMP, VALUE(3), 1 }, + SENSORS_MODE_R, GL518_SYSCTL_TEMP, VALUE(3), 1 }, { SENSORS_GL518R80_TEMP_HYST, "temp_hyst", SENSORS_GL518R80_TEMP, - SENSORS_GL518R80_TEMP, SENSORS_RW, + SENSORS_GL518R80_TEMP, SENSORS_MODE_RW, GL518_SYSCTL_TEMP, VALUE(2), 1 }, { SENSORS_GL518R80_TEMP_OVER, "temp_over", SENSORS_GL518R80_TEMP, - SENSORS_GL518R80_TEMP, SENSORS_RW, + SENSORS_GL518R80_TEMP, SENSORS_MODE_RW, GL518_SYSCTL_VDD, VALUE(1), 1 }, { SENSORS_GL518R80_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, - SENSORS_R, GL518_SYSCTL_VID, VALUE(1), 0 }, + SENSORS_MODE_R, GL518_SYSCTL_VID, VALUE(1), 0 }, { SENSORS_GL518R80_FAN1_DIV, "fan1_div", SENSORS_GL518R80_FAN1, - SENSORS_NO_MAPPING, SENSORS_RW, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, GL518_SYSCTL_FAN_DIV, VALUE(1), 0 }, { SENSORS_GL518R80_FAN2_DIV, "fan2_div", SENSORS_GL518R80_FAN2, - SENSORS_NO_MAPPING, SENSORS_RW, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, GL518_SYSCTL_FAN_DIV, VALUE(2), 0 }, { SENSORS_GL518R80_ALARMS, "alarms", SENSORS_NO_MAPPING, - SENSORS_NO_MAPPING, SENSORS_R, + SENSORS_NO_MAPPING, SENSORS_MODE_R, GL518_SYSCTL_FAN_DIV, VALUE(3), 0 }, { 0 } }; diff --git a/lib/sensors.h b/lib/sensors.h index d8526607..bff9cea8 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -30,6 +30,7 @@ #define SENSORS_CHIP_NAME_BUS_ANY_I2C -3 #define SENSORS_CHIP_NAME_ADDR_ANY -1 +/* A chip name is encoded is in this structure */ typedef struct sensors_chip_name { char *prefix; int bus; @@ -80,7 +81,7 @@ extern int sensors_get_feature(sensors_chip_name name, int feature, /* Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 - on failure. */ + on failure. BUGGY! */ extern int sensors_set_feature(sensors_chip_name name, int feature, double value); @@ -91,4 +92,35 @@ extern int sensors_set_feature(sensors_chip_name name, int feature, extern const sensors_chip_name *sensors_get_detected_chips(int *nr); +/* These defines are used in the mode field of sensors_feature_data */ +#define SENSORS_MODE_NO_RW 0 +#define SENSORS_MODE_R 1 +#define SENSORS_MODE_W 2 +#define SENSORS_MODE_RW 3 + +/* This define is used in the mapping field of sensors_feature_data if no + 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; + const char *name; + int mapping; + int unused; + 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); + #endif /* def LIB_SENSORS_ERROR_H */ diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 0605d22a..116f83b8 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -218,3 +218,30 @@ void print_lm78(const sensors_chip_name *name) free_the_label(&label); } +void print_unknown_chip(const sensors_chip_name *name) +{ + int a,b; + const sensors_feature_data *data; + char *label; + double val; + + a=b=0; + while((data=sensors_get_all_features(*name,&a,&b))) { + if (sensors_get_label(*name,data->number,&label)) { + printf("ERROR: Can't get feature `%s' data!",data->name); + continue; + } + if (data->mode & SENSORS_MODE_R) { + if(sensors_get_feature(*name,data->number,&val)) { + printf("ERROR: Can't get feature `%s' data!",data->name); + continue; + } + if (data->mapping != SENSORS_NO_MAPPING) + printf(" %s: %.2f (%s)\n",label,val,data->name); + else + printf("%s: %.2f (%s)\n",label,val,data->name); + } else + printf("(%s)",label); + } +} + diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 1d03fb88..33f96f84 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -22,6 +22,8 @@ #include "lib/sensors.h" +extern void print_unknown_chip(const sensors_chip_name *name); + extern void print_lm75(const sensors_chip_name *name); extern void print_lm78(const sensors_chip_name *name); diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 410432a5..145587a6 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -165,6 +165,7 @@ int main (int argc, char *argv[]) } /* Here comes the real code... */ + for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) { if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) printf("%s-isa-%04x\n",chip->prefix,chip->addr); @@ -183,7 +184,11 @@ int main (int argc, char *argv[]) else if (!strcmp(chip->prefix,"lm78") || !strcmp(chip->prefix,"lm78-j") || !strcmp(chip->prefix,"lm79")) print_lm78(chip); + else + print_unknown_chip(chip); printf("\n"); } exit(0); } + +