mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 06:15:15 +00:00
Fixes to the dynamic chip support:
* Fix the handling of temperature hysteresis. Hysteresis is not a temperature limit by itself, but a property of temperature limit. * Handle per-limit temperature alarms. With these fixes, the ADM1032 is properly supported by the new code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4423 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -515,13 +515,17 @@ struct feature_type_match
|
||||
};
|
||||
|
||||
static struct feature_type_match temp_matches[] = {
|
||||
{ "hyst", SENSORS_FEATURE_TEMP_HYST },
|
||||
{ "over", SENSORS_FEATURE_TEMP_OVER },
|
||||
{ "max", SENSORS_FEATURE_TEMP_MAX },
|
||||
{ "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST },
|
||||
{ "min", SENSORS_FEATURE_TEMP_MIN },
|
||||
{ "low", SENSORS_FEATURE_TEMP_LOW },
|
||||
{ "crit", SENSORS_FEATURE_TEMP_CRIT },
|
||||
{ "crit_hyst", SENSORS_FEATURE_TEMP_CRIT_HYST },
|
||||
{ "alarm", SENSORS_FEATURE_TEMP_ALARM },
|
||||
{ "min_alarm", SENSORS_FEATURE_TEMP_MIN_ALARM },
|
||||
{ "max_alarm", SENSORS_FEATURE_TEMP_MAX_ALARM },
|
||||
{ "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM },
|
||||
{ "fault", SENSORS_FEATURE_TEMP_FAULT },
|
||||
{ "type", SENSORS_FEATURE_TEMP_SENS },
|
||||
{ 0 }
|
||||
|
@@ -166,15 +166,19 @@ typedef enum sensors_feature_type {
|
||||
SENSORS_FEATURE_FAN_DIV,
|
||||
|
||||
SENSORS_FEATURE_TEMP = 0x200,
|
||||
SENSORS_FEATURE_TEMP_HYST,
|
||||
SENSORS_FEATURE_TEMP_OVER,
|
||||
SENSORS_FEATURE_TEMP_MAX,
|
||||
SENSORS_FEATURE_TEMP_MAX_HYST,
|
||||
SENSORS_FEATURE_TEMP_MIN,
|
||||
SENSORS_FEATURE_TEMP_HIGH,
|
||||
SENSORS_FEATURE_TEMP_LOW,
|
||||
SENSORS_FEATURE_TEMP_LIM,
|
||||
SENSORS_FEATURE_TEMP_CRIT,
|
||||
SENSORS_FEATURE_TEMP_CRIT_HYST,
|
||||
SENSORS_FEATURE_TEMP_ALARM = 0x210,
|
||||
SENSORS_FEATURE_TEMP_MAX_ALARM,
|
||||
SENSORS_FEATURE_TEMP_MIN_ALARM,
|
||||
SENSORS_FEATURE_TEMP_CRIT_ALARM,
|
||||
SENSORS_FEATURE_TEMP_FAULT,
|
||||
SENSORS_FEATURE_TEMP_SENS,
|
||||
|
||||
@@ -185,7 +189,7 @@ typedef enum sensors_feature_type {
|
||||
|
||||
/* special the largest number of subfeatures used, iow the
|
||||
highest ## from all the 0x?## above + 1*/
|
||||
SENSORS_FEATURE_MAX_SUB_FEATURES = 19
|
||||
SENSORS_FEATURE_MAX_SUB_FEATURES = 22
|
||||
} sensors_feature_type;
|
||||
|
||||
sensors_feature_type sensors_feature_get_type
|
||||
|
@@ -144,27 +144,16 @@ static void print_generic_chip_temp(const sensors_chip_name *name,
|
||||
} else {
|
||||
type = MINMAX;
|
||||
}
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST);
|
||||
type = HYST;
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT);
|
||||
type = CRIT;
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST);
|
||||
type = HYST;
|
||||
} else {
|
||||
min = 0;
|
||||
type = MAXONLY;
|
||||
}
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST);
|
||||
|
||||
if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_OVER)) {
|
||||
max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER);
|
||||
type = HYST;
|
||||
} else {
|
||||
max = min;
|
||||
max = 0;
|
||||
type = HYSTONLY;
|
||||
}
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_LOW)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_LOW);
|
||||
|
||||
@@ -208,23 +197,25 @@ static void print_generic_chip_temp(const sensors_chip_name *name,
|
||||
if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) &&
|
||||
TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT) > 0.5) {
|
||||
printf(" FAULT");
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) &&
|
||||
TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) {
|
||||
} else
|
||||
if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) &&
|
||||
TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5)
|
||||
|| (type == MINMAX &&
|
||||
TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) &&
|
||||
TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5)
|
||||
|| (type == MINMAX &&
|
||||
TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) &&
|
||||
TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5)) {
|
||||
printf(" ALARM");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (type == MINMAX && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT))
|
||||
{
|
||||
if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) {
|
||||
const sensors_feature_data *subfeature;
|
||||
max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT);
|
||||
|
||||
if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST);
|
||||
type = HYSTONLY;
|
||||
} else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX) &&
|
||||
!TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX);
|
||||
if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) {
|
||||
min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST);
|
||||
type = HYSTONLY;
|
||||
} else {
|
||||
type = SINGLE;
|
||||
@@ -239,7 +230,11 @@ static void print_generic_chip_temp(const sensors_chip_name *name,
|
||||
if (valid) {
|
||||
print_label(label, label_size);
|
||||
free(label);
|
||||
print_temp_info_real(max, min, 0, 0.0, type, 1, 0);
|
||||
print_temp_info_real(max, min, 0, 0.0, type, 1, 1);
|
||||
if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) &&
|
||||
TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5) {
|
||||
printf(" ALARM");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user