From 1bd92120659febdcd19bfa7dbc3722fe00e7b753 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 12:38:28 +0000 Subject: [PATCH] Fill the magnitude field of dynamically generated device entries. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4420 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/sysfs.c b/lib/sysfs.c index bd525b91..88863ba8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -37,6 +37,29 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 16 +static +int get_type_scaling(int type) +{ + switch (type & 0xFF10) { + case SENSORS_FEATURE_IN: + case SENSORS_FEATURE_TEMP: + return 3; + case SENSORS_FEATURE_FAN: + return 0; + } + + switch (type) { + case SENSORS_FEATURE_VID: + return 3; + case SENSORS_FEATURE_VRM: + return 1; + default: + return 0; + } + + return 0; +} + static sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) { @@ -149,6 +172,8 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) SENSORS_MODE_R : (attr->method & SYSFS_METHOD_STORE) ? SENSORS_MODE_W : SENSORS_MODE_NO_RW; + feature.scaling = get_type_scaling(type); + features[i] = feature; fnum++; }