From 61686376df1a04f075f86c761b349ee92100a468 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 12:31:12 +0000 Subject: [PATCH] Add support for temperature offset files, which are part of the standard sysfs interface. I don't think it makes much sense to display the offset values as part of the output of "sensors" (it would even probably confuse people) but having support for these in libsensors makes it possible to adjust the offsets in sensors.conf, which is convenient. This closes ticket #2248. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4769 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 1 + lib/sensors.h | 1 + lib/sysfs.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/access.c b/lib/access.c index 1c799f78..8fd926c0 100644 --- a/lib/access.c +++ b/lib/access.c @@ -521,6 +521,7 @@ static const struct feature_subtype_match temp_matches[] = { { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, { "fault", SENSORS_FEATURE_TEMP_FAULT }, { "type", SENSORS_FEATURE_TEMP_TYPE }, + { "offset", SENSORS_FEATURE_TEMP_OFFSET }, { NULL, 0 } }; diff --git a/lib/sensors.h b/lib/sensors.h index 7100f1ec..13cea557 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -151,6 +151,7 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_CRIT_ALARM, SENSORS_FEATURE_TEMP_FAULT, SENSORS_FEATURE_TEMP_TYPE, + SENSORS_FEATURE_TEMP_OFFSET, SENSORS_FEATURE_VID = 0x1000, diff --git a/lib/sysfs.c b/lib/sysfs.c index 10d69392..8147d525 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -1,6 +1,7 @@ /* sysfs.c - Part of libsensors, a library for reading Linux sensor data Copyright (c) 2005 Mark M. Hoffman + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 20 -#define MAX_SUB_FEATURES 6 +#define MAX_SUB_FEATURES 7 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID + misc features */ #define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ @@ -56,6 +57,7 @@ int get_type_scaling(int type) switch (type) { case SENSORS_FEATURE_VID: + case SENSORS_FEATURE_TEMP_OFFSET: return 1000; default: return 1;