From 16628b516586ce85267e4180d0799cb8a47ae13c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 8 May 2004 12:24:16 +0000 Subject: [PATCH] Patches by Aurelien Jarno: I found a small bug in sensors and sensord when used with a w83781d chip. On this chip the alarms for temp2 and temp3 are merged. However that is not handled in sensors and sensord. Please find attached two patches to fix that, one concerning sensors and the other one concerning sensord. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2511 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 54 ++++++++++++++++++++++++++++++++++++++++---- prog/sensors/chips.c | 11 ++++++--- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index c5e1533b..847d9df8 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -599,11 +599,56 @@ fmtTemps_W83781D } static const char *w83781d_names[] = { - SENSORS_W83781D_PREFIX, SENSORS_AS99127F_PREFIX, NULL + SENSORS_W83781D_PREFIX, NULL }; -/* TODO: beeps inverted for as99127f */ static const FeatureDescriptor w83781d_features[] = { + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, + { SENSORS_W83781D_IN0, SENSORS_W83781D_IN0_MIN, SENSORS_W83781D_IN0_MAX, -1 } }, + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1, + { SENSORS_W83781D_IN1, SENSORS_W83781D_IN1_MIN, SENSORS_W83781D_IN1_MAX, -1 } }, + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2, + { SENSORS_W83781D_IN2, SENSORS_W83781D_IN2_MIN, SENSORS_W83781D_IN2_MAX, -1 } }, + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3, + { SENSORS_W83781D_IN3, SENSORS_W83781D_IN3_MIN, SENSORS_W83781D_IN3_MAX, -1 } }, + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4, + { SENSORS_W83781D_IN4, SENSORS_W83781D_IN4_MIN, SENSORS_W83781D_IN4_MAX, -1 } }, + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5, + { SENSORS_W83781D_IN5, SENSORS_W83781D_IN5_MIN, SENSORS_W83781D_IN5_MAX, -1 } }, + { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6, + { SENSORS_W83781D_IN6, SENSORS_W83781D_IN6_MIN, SENSORS_W83781D_IN6_MAX, -1 } }, + { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1, + { SENSORS_W83781D_FAN1, SENSORS_W83781D_FAN1_MIN, SENSORS_W83781D_FAN1_DIV, -1 } }, + { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2, + { SENSORS_W83781D_FAN2, SENSORS_W83781D_FAN2_MIN, SENSORS_W83781D_FAN2_DIV, -1 } }, + { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3, + { SENSORS_W83781D_FAN3, SENSORS_W83781D_FAN3_MIN, SENSORS_W83781D_FAN3_DIV, -1 } }, + { fmtTemps_W83781D, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1, + { SENSORS_W83781D_TEMP1, SENSORS_W83781D_TEMP1_OVER, SENSORS_W83781D_TEMP1_HYST, -1 } }, + { fmtTemps_1_0, rrdF1, DataType_temperature, W83781D_ALARM_TEMP23, W83781D_ALARM_TEMP23, + { SENSORS_W83781D_TEMP2, SENSORS_W83781D_TEMP2_OVER, SENSORS_W83781D_TEMP2_HYST, -1 } }, + { fmtTemps_1_0, rrdF1, DataType_temperature, W83781D_ALARM_TEMP23, W83781D_ALARM_TEMP23, + { SENSORS_W83781D_TEMP3, SENSORS_W83781D_TEMP3_OVER, SENSORS_W83781D_TEMP3_HYST, -1 } }, + { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, + { SENSORS_W83781D_VID, -1 } }, + { fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS, + { SENSORS_W83781D_ALARMS, -1 } }, + { fmtSoundAlarm, NULL, DataType_other, 0, 0, + { SENSORS_W83781D_BEEP_ENABLE, -1 } }, + { NULL } +}; + +static const ChipDescriptor w83781d_chip = { + w83781d_names, w83781d_features, SENSORS_W83781D_ALARMS, SENSORS_W83781D_BEEPS +}; + +/** AS99127F **/ + +static const char *as99127f_names[] = { + SENSORS_AS99127F_PREFIX, NULL +}; + +static const FeatureDescriptor as99127f_features[] = { { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, { SENSORS_W83781D_IN0, SENSORS_W83781D_IN0_MIN, SENSORS_W83781D_IN0_MAX, -1 } }, { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1, @@ -639,8 +684,8 @@ static const FeatureDescriptor w83781d_features[] = { { NULL } }; -static const ChipDescriptor w83781d_chip = { - w83781d_names, w83781d_features, SENSORS_W83781D_ALARMS, SENSORS_W83781D_BEEPS +static const ChipDescriptor as99127f_chip = { + as99127f_names, as99127f_features, SENSORS_W83781D_ALARMS, SENSORS_W83781D_BEEPS }; /** W83782D **/ @@ -975,6 +1020,7 @@ const ChipDescriptor * const knownChips[] = { &maxilife_chip, &sis5595_chip, &via686a_chip, + &as99127f_chip, &w83781d_chip, &w83782d_chip, &w83783s_chip, diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index fa74f8f0..2eeb8162 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -2080,8 +2080,9 @@ void print_w83781d(const sensors_chip_name *name) char *label = NULL; double cur,min,max,fdiv,sens; int alarms,beeps; - int is82d, is83s, is697hf, is627thf, valid; + int is81d, is82d, is83s, is697hf, is627thf, valid; + is81d = !strcmp(name->prefix,"w83781d"); is82d = (!strcmp(name->prefix,"w83782d")) || (!strcmp(name->prefix,"w83627hf")) || (!strcmp(name->prefix,"w83637hf")) || @@ -2343,8 +2344,12 @@ void print_w83781d(const sensors_chip_name *name) if(!is82d) { print_label(label,10); print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s %s\n", alarms&W83781D_ALARM_TEMP3 ?"ALARM":" ", - beeps&W83781D_ALARM_TEMP3?"(beep)":""); + if (!is81d) + printf(" %s %s\n", alarms&W83781D_ALARM_TEMP3?"ALARM":" ", + beeps&W83781D_ALARM_TEMP3?"(beep)":""); + else + printf(" %s %s\n", alarms&W83781D_ALARM_TEMP23?"ALARM":" ", + beeps&W83781D_ALARM_TEMP23?"(beep)":""); } else { if(!sensors_get_feature(*name,SENSORS_W83781D_SENS3,&sens)) { print_label(label,10);