--- wmsensormon-1.2.0/wmsensormon/wmsensormon.c.orig 2004-05-24 05:33:19.000000000 +0100 +++ wmsensormon-1.2.0/wmsensormon/wmsensormon.c 2004-11-27 00:05:22.832552994 +0000 @@ -1,7 +1,7 @@ /*********************************************************************************************** wmsensormon - a sensor monitor for WindowMaker thanks to wmbp6 by RedSeb -VERSION : 1.2.0 -DATE : 5/24/2004 +VERSION : 1.2.1 +DATE : 11/27/2004 AUTHOR : Liverbugg REQUIREMENTS : Lm_sensors, i2c, WindowMaker, Motherboard with supported sensors USE : To monitor the sensors on your motherboard @@ -29,10 +29,11 @@ USE : To monitor the sensors on #define ERR_MODULES "\tCan't find \"/etc/sensors.conf\".\n" \ "\tCheck the instalation of lm_sensors.\n" #define ERR_CONF_SENS "\tProblems with \"/etc/sensors.conf\".\n" +#define ERR_SENS_DETECT "\tNo suitable sensors detected.\n" #define DELAI_DCLICK 10000 #define CPT_DCLICK 10 -#define VERSION "1.2.0" -#define DATE "5/24/2004" +#define VERSION "1.2.1" +#define DATE "11/27/2004" #define VOLT1 1 #define VOLT1_MIN 11 @@ -75,7 +76,8 @@ int main(int argc, char **argv) volt0_p = 0, t_max, fan_min, volt0 = 0, v_min, v_max, syst_max, add = 0, unit = 0, smp = 0, swap = 0, swapfan = 0, log = 0, t_warn, syst_warn, fan_warn; - const sensors_chip_name *chipset; + const sensors_chip_name *chipset; + const sensors_feature_data *feature; int chip_nr = 0, opt = 0, offset = 0, offset2 = 1, i = 0, d = 0, logd = 30000; float volt0_per; @@ -98,8 +100,41 @@ int main(int argc, char **argv) } } fclose(config_file); - chipset = sensors_get_detected_chips(&chip_nr); - + + do + { + feature = NULL; + chipset = sensors_get_detected_chips(&chip_nr); + + /* Is there a chip here? */ + if (!chipset) + chip_nr = 0; + else + { + int nr1 = 0, nr2 = 0; + + /* Does this chip have a temperature sensor? */ + do + { + feature = sensors_get_all_features(*chipset, &nr1, &nr2); + if ((feature) && (!strcmp(feature->name, "temp1"))) + break; + } while (feature); + + /* Is this chip suitable? */ + if (feature) + break; + } + + } while (chip_nr > 0); + + /* Did we find a suitable chip? */ + if (!chip_nr) + { + puts(ERR_SENS_DETECT); + exit(ERROR); + } + sensors_get_feature(*chipset,TEMP2_OVER, &t_max_d); sensors_get_feature(*chipset,TEMP3_OVER, &syst_max_d); sensors_get_feature(*chipset,FAN1_MIN, &fan_min_d);