From f945c74d5010aa5524a69d80687b28df52caa859 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 14 Oct 2007 12:00:15 +0000 Subject: [PATCH] Several fixes to the fschmd support git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4952 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/chips.c | 2 +- lib/proc.c | 3 +-- prog/sensors/chips.c | 25 ++++++++++++++++--------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/chips.c b/lib/chips.c index 3a398587..daf9d248 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -6342,7 +6342,7 @@ static sensors_chip_feature f71882fg_features[] = NOMAP, NOMAP, R }, \ NOSYSCTL, VALUE(1), 0 }, \ { { SENSORS_FSCHMD_FAN_DIV(nr), "fan" #nr "_div", \ - SENSORS_FSCHMD_FAN(nr), NOMAP, R }, \ + SENSORS_FSCHMD_FAN(nr), NOMAP, RW }, \ NOSYSCTL, VALUE(nr), 0 }, \ { { SENSORS_FSCHMD_FAN_ALARM(nr), "fan" #nr "_alarm", \ SENSORS_FSCHMD_FAN(nr), NOMAP, R }, \ diff --git a/lib/proc.c b/lib/proc.c index 22944555..e5de2656 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -455,8 +455,7 @@ static int getsysname(const sensors_chip_feature *feature, char *sysname, /* give up, use old name (probably won't work though...) */ /* known to be the same: - "alarms", "beep_enable", "vrm", "fan%d_div" (except old fscxxx drivers - which use fan%d_ripple, fixed using altsysname for new drv. GRR) + "alarms", "beep_enable", "vrm", "fan%d_div" */ strcpy(sysname, name); *sysmag = feature->scaling; diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index af06b799..792de9d9 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -6354,10 +6354,9 @@ static void print_fschmd_fan(const sensors_chip_name *name, int i, printf("%4.0f RPM (div = %1.0f) %s\n", cur, fdiv, alarm ? "ALARM" : ""); } - } - /* no error on failure as we get used for various FSC chips and not all - have the same amount of fan sensors */ - + } else { + printf("ERROR: Can't get fan%d data!\n", i); + } free(label); } @@ -6387,25 +6386,33 @@ static void print_fschmd_temp(const sensors_chip_name *name, int i, printf("%s\n", alarm ? "ALARM" : ""); } } + } else { + printf("ERROR: Can't get temp%d data!\n", i); } - /* no error on failure as we get used for various FSC chips and not all - have the same amount of temp sensors */ - free(label); } void print_fschmd(const sensors_chip_name *name) { int i; + int no_fan_sensors, no_temp_sensors; + + if (!strcmp(name->prefix,"fschmd")) { + no_fan_sensors = 5; + no_temp_sensors = 5; + } else { /* fschrc */ + no_fan_sensors = 4; + no_temp_sensors = 3; + } for (i = 0; i <= 2; i++) print_fschmd_in(name, i, SENSORS_FSCHMD_IN(i)); - for (i = 1; i <= 6; i++) + for (i = 1; i <= no_fan_sensors; i++) print_fschmd_fan(name, i, SENSORS_FSCHMD_FAN(i), SENSORS_FSCHMD_FAN_DIV(i)); - for (i = 1; i <= 5; i++) + for (i = 1; i <= no_temp_sensors; i++) print_fschmd_temp(name, i, SENSORS_FSCHMD_TEMP(i), SENSORS_FSCHMD_TEMP_MAX(i)); }