mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-10 16:30:50 +00:00
Renumber feature and subfeature types to leave more room if we later
need to add more feature or subfeature types. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4858 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
df027fb0d5
commit
d1b374cc38
2 files changed
+15
-18
No files matched your search
+11
-14
@@ -124,43 +124,40 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name
|
||||
mapping is available */
|
||||
#define SENSORS_NO_MAPPING -1
|
||||
|
||||
/* These must match the subfeature constants below (shifted by 8 bits) */
|
||||
typedef enum sensors_feature_type {
|
||||
SENSORS_FEATURE_IN = 0x00,
|
||||
SENSORS_FEATURE_FAN = 0x01,
|
||||
SENSORS_FEATURE_TEMP = 0x02,
|
||||
SENSORS_FEATURE_VID = 0x10,
|
||||
SENSORS_FEATURE_BEEP_ENABLE = 0x11,
|
||||
SENSORS_FEATURE_BEEP_ENABLE = 0x18,
|
||||
SENSORS_FEATURE_UNKNOWN = INT_MAX,
|
||||
} sensors_feature_type;
|
||||
|
||||
/* 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 subfeatures which should not have a compute
|
||||
mapping to the _input subfeature start at 0x?10. */
|
||||
/* All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart,
|
||||
and sensor subfeatures which have no compute mapping have bit 7 set. */
|
||||
typedef enum sensors_subfeature_type {
|
||||
SENSORS_SUBFEATURE_IN_INPUT = 0x000,
|
||||
SENSORS_SUBFEATURE_IN_INPUT = SENSORS_FEATURE_IN << 8,
|
||||
SENSORS_SUBFEATURE_IN_MIN,
|
||||
SENSORS_SUBFEATURE_IN_MAX,
|
||||
SENSORS_SUBFEATURE_IN_ALARM = 0x010,
|
||||
SENSORS_SUBFEATURE_IN_ALARM = (SENSORS_FEATURE_IN << 8) | 0x80,
|
||||
SENSORS_SUBFEATURE_IN_MIN_ALARM,
|
||||
SENSORS_SUBFEATURE_IN_MAX_ALARM,
|
||||
SENSORS_SUBFEATURE_IN_BEEP,
|
||||
|
||||
SENSORS_SUBFEATURE_FAN_INPUT = 0x100,
|
||||
SENSORS_SUBFEATURE_FAN_INPUT = SENSORS_FEATURE_FAN << 8,
|
||||
SENSORS_SUBFEATURE_FAN_MIN,
|
||||
SENSORS_SUBFEATURE_FAN_ALARM = 0x110,
|
||||
SENSORS_SUBFEATURE_FAN_ALARM = (SENSORS_FEATURE_FAN << 8) | 0x80,
|
||||
SENSORS_SUBFEATURE_FAN_FAULT,
|
||||
SENSORS_SUBFEATURE_FAN_DIV,
|
||||
SENSORS_SUBFEATURE_FAN_BEEP,
|
||||
|
||||
SENSORS_SUBFEATURE_TEMP_INPUT = 0x200,
|
||||
SENSORS_SUBFEATURE_TEMP_INPUT = SENSORS_FEATURE_TEMP << 8,
|
||||
SENSORS_SUBFEATURE_TEMP_MAX,
|
||||
SENSORS_SUBFEATURE_TEMP_MAX_HYST,
|
||||
SENSORS_SUBFEATURE_TEMP_MIN,
|
||||
SENSORS_SUBFEATURE_TEMP_CRIT,
|
||||
SENSORS_SUBFEATURE_TEMP_CRIT_HYST,
|
||||
SENSORS_SUBFEATURE_TEMP_ALARM = 0x210,
|
||||
SENSORS_SUBFEATURE_TEMP_ALARM = (SENSORS_FEATURE_TEMP << 8) | 0x80,
|
||||
SENSORS_SUBFEATURE_TEMP_MAX_ALARM,
|
||||
SENSORS_SUBFEATURE_TEMP_MIN_ALARM,
|
||||
SENSORS_SUBFEATURE_TEMP_CRIT_ALARM,
|
||||
@@ -169,9 +166,9 @@ typedef enum sensors_subfeature_type {
|
||||
SENSORS_SUBFEATURE_TEMP_OFFSET,
|
||||
SENSORS_SUBFEATURE_TEMP_BEEP,
|
||||
|
||||
SENSORS_SUBFEATURE_VID = 0x1000,
|
||||
SENSORS_SUBFEATURE_VID = SENSORS_FEATURE_VID << 8,
|
||||
|
||||
SENSORS_SUBFEATURE_BEEP_ENABLE = 0x1100,
|
||||
SENSORS_SUBFEATURE_BEEP_ENABLE = SENSORS_FEATURE_BEEP_ENABLE << 8,
|
||||
|
||||
SENSORS_SUBFEATURE_UNKNOWN = INT_MAX,
|
||||
} sensors_subfeature_type;
|
||||
|
||||
+4
-4
@@ -48,7 +48,7 @@ char sensors_sysfs_mount[NAME_MAX];
|
||||
static
|
||||
int get_type_scaling(sensors_subfeature_type type)
|
||||
{
|
||||
switch (type & 0xFF10) {
|
||||
switch (type & 0xFF80) {
|
||||
case SENSORS_SUBFEATURE_IN_INPUT:
|
||||
case SENSORS_SUBFEATURE_TEMP_INPUT:
|
||||
return 1000;
|
||||
@@ -240,8 +240,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
|
||||
default:
|
||||
i = (sftype >> 8) * MAX_SENSORS_PER_TYPE *
|
||||
MAX_SUBFEATURES * 2 + nr * MAX_SUBFEATURES * 2 +
|
||||
((sftype & 0x10) >> 4) * MAX_SUBFEATURES +
|
||||
(sftype & 0x0F);
|
||||
((sftype & 0x80) >> 7) * MAX_SUBFEATURES +
|
||||
(sftype & 0x7F);
|
||||
}
|
||||
|
||||
if (all_subfeatures[i].name) {
|
||||
@@ -255,7 +255,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
|
||||
/* fill in the subfeature members */
|
||||
all_subfeatures[i].type = sftype;
|
||||
all_subfeatures[i].name = strdup(name);
|
||||
if (!(sftype & 0x10))
|
||||
if (!(sftype & 0x80))
|
||||
all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING;
|
||||
if (attr->method & SYSFS_METHOD_SHOW)
|
||||
all_subfeatures[i].flags |= SENSORS_MODE_R;
|
||||
|
||||
Reference in new issue
Block a user