diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-10-24 09:04:26 +0000 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2008-10-24 09:04:26 +0000 |
commit | 51a621be436db9f4484b28cae6b2e0401a380fc8 (patch) | |
tree | 066dde768470ba48e2c27c82cbfd92547159d67f /lib/sysfs.c | |
parent | d766935c47d047e3479ce7eb6d06981bc17bcef7 (diff) | |
download | lm-sensors-git-51a621be436db9f4484b28cae6b2e0401a380fc8.tar.gz |
Add support for current sensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5379 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r-- | lib/sysfs.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c index 7924d8d7..de578694 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -138,7 +138,7 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 20 #define MAX_SUBFEATURES 8 -#define MAX_SENSOR_TYPES 5 +#define MAX_SENSOR_TYPES 6 /* Room for all 5 types (in, fan, temp, power, energy) with all their subfeatures + VID + misc features */ #define ALL_POSSIBLE_SUBFEATURES \ @@ -153,6 +153,7 @@ int get_type_scaling(sensors_subfeature_type type) switch (type & 0xFF80) { case SENSORS_SUBFEATURE_IN_INPUT: case SENSORS_SUBFEATURE_TEMP_INPUT: + case SENSORS_SUBFEATURE_CURR_INPUT: return 1000; case SENSORS_SUBFEATURE_FAN_INPUT: return 1; @@ -184,6 +185,7 @@ char *get_feature_name(sensors_feature_type ftype, char *sfname) case SENSORS_FEATURE_TEMP: case SENSORS_FEATURE_POWER: case SENSORS_FEATURE_ENERGY: + case SENSORS_FEATURE_CURR: underscore = strchr(sfname, '_'); name = strndup(sfname, underscore - sfname); break; @@ -259,6 +261,16 @@ static const struct subfeature_type_match energy_matches[] = { { NULL, 0 } }; +static const struct subfeature_type_match curr_matches[] = { + { "input", SENSORS_SUBFEATURE_CURR_INPUT }, + { "min", SENSORS_SUBFEATURE_CURR_MIN }, + { "max", SENSORS_SUBFEATURE_CURR_MAX }, + { "alarm", SENSORS_SUBFEATURE_CURR_ALARM }, + { "min_alarm", SENSORS_SUBFEATURE_CURR_MIN_ALARM }, + { "max_alarm", SENSORS_SUBFEATURE_CURR_MAX_ALARM }, + { NULL, 0 } +}; + static const struct subfeature_type_match cpu_matches[] = { { "vid", SENSORS_SUBFEATURE_VID }, { NULL, 0 } @@ -270,6 +282,7 @@ static struct feature_type_match matches[] = { { "fan%d%c", fan_matches }, { "cpu%d%c", cpu_matches }, { "power%d%c", power_matches }, + { "curr%d%c", curr_matches }, { "energy%d%c", energy_matches }, }; @@ -360,6 +373,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, case SENSORS_SUBFEATURE_TEMP_INPUT: case SENSORS_SUBFEATURE_POWER_AVERAGE: case SENSORS_SUBFEATURE_ENERGY_INPUT: + case SENSORS_SUBFEATURE_CURR_INPUT: nr--; break; } |