From 8e274a9e0412e74e28808bdf1456bdd013b39107 Mon Sep 17 00:00:00 2001 From: Merlin Hughes Date: Fri, 7 Jul 2000 21:23:43 +0000 Subject: [PATCH] Added support in sensors prog for `ignore' settings on alarms so you can flag chassis intrusion detection to be ignored, etc. Updated CHANGES to reflect this and updates to sensord. -- merlin git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@837 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ doc/progs | 9 ++++---- prog/sensors/chips.c | 52 +++++++++++++++++++++++++------------------- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index d94308ac..c76ff57c 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,8 @@ ask CVS about it: Programs: understand /dev/i2c* files (instead of /dev/i2c-*) too. Program sensors-detect: more robustness in case of unknown i2c adapters Module w83781d: W83783S no longer crashes on unloading + Program sensord: more flexility, support for alarm scanning etc. + Program sensors: support for ignore setting on sensor alarms. 2.5.1 (20000618) Library: Add adm1025 support diff --git a/doc/progs b/doc/progs index c9bb9a30..68388b71 100644 --- a/doc/progs +++ b/doc/progs @@ -52,11 +52,10 @@ this package. This script creates the /dev/i2c-* files. Please check the source before you run it, as you may need to set some variables first. * prog/sensord/sensord (written in C, installed by `make install-prog-sensord') - This daemon logs sensor information every 5 minutes to the log file - /var/log/sensors, in a similar format to sensors (below). This is a bit - more lightweight than executing sensors every 5 minutes, depending on how - you look at things. Automatically picks up configuration updates and - responds to SIGHUP. + This daemon can be used to periodically log sensor readings from + the sensors hardware to syslog, and to alert (using syslog level ALERT) + when a sensor alarm is signalled; for example, if a fan fails, a temperature + limit is exceeded, etc. * prog/sensors/sensors (written in C, installed by `make install') This pretty-prints the information provided by the modules. It is a normal console application, using stdin and stdout. It is essential, because diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 53216db8..3b109b1c 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -415,7 +415,8 @@ void print_sis5595(const sensors_chip_name *name) printf("ERROR: Can't get TEMP data!\n"); free_the_label(&label); - if (!sensors_get_label(*name,SENSORS_SIS5595_ALARMS,&label)) { + if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_ALARMS,&label,&valid) + && valid) { print_label(label,10); printf("Board temperature input (usually LM75 chips) %s\n", alarms & SIS5595_ALARM_BTI ?"ALARM":" "); @@ -720,7 +721,8 @@ void print_lm78(const sensors_chip_name *name) } free_the_label(&label); - if (!sensors_get_label(*name,SENSORS_LM78_ALARMS,&label)) { + if (!sensors_get_label_and_valid(*name,SENSORS_LM78_ALARMS,&label,&valid) + && valid) { print_label(label,10); printf("Board temperature input (usually LM75 chips) %s\n", alarms & LM78_ALARM_BTI?"ALARM":""); @@ -904,15 +906,17 @@ void print_gl518(const sensors_chip_name *name) printf("ERROR: Can't get TEMP data!\n"); free_the_label(&label); - if (!sensors_get_label(*name,SENSORS_GL518_BEEP_ENABLE,&label) && - !sensors_get_feature(*name,SENSORS_GL518_BEEP_ENABLE,&cur)) { - print_label(label,10); - if (cur < 0.5) - printf("Sound alarm disabled\n"); - else - printf("Sound alarm enabled\n"); - } else - printf("ERROR: Can't get BEEP data!\n"); + if (!sensors_get_label_and_valid(*name,SENSORS_GL518_BEEP_ENABLE,&label,&valid) + && valid) { + if (!sensors_get_feature(*name,SENSORS_GL518_BEEP_ENABLE,&cur)) { + print_label(label,10); + if (cur < 0.5) + printf("Sound alarm disabled\n"); + else + printf("Sound alarm enabled\n"); + } else + printf("ERROR: Can't get BEEP data!\n"); + } free_the_label(&label); } @@ -1157,7 +1161,8 @@ void print_lm80(const sensors_chip_name *name) printf("ERROR: Can't get TEMP data!\n"); free_the_label(&label); - if (!sensors_get_label(*name,SENSORS_LM80_ALARMS,&label)) { + if (!sensors_get_label_and_valid(*name,SENSORS_LM80_ALARMS,&label,&valid) + && valid) { if (alarms & LM80_ALARM_BTI) { print_label(label,10); printf("Board temperature input (a LM75 perhaps?) ALARM\n"); @@ -1459,7 +1464,8 @@ void print_w83781d(const sensors_chip_name *name) } free_the_label(&label); - if (!sensors_get_label(*name,SENSORS_W83781D_ALARMS,&label)) { + if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_ALARMS,&label,&valid) + && valid) { print_label(label,10); printf("Chassis intrusion detection %s %s\n", alarms & W83781D_ALARM_CHAS?"ALARM":" ", @@ -1467,15 +1473,17 @@ void print_w83781d(const sensors_chip_name *name) } free_the_label(&label); - if (!sensors_get_label(*name,SENSORS_W83781D_BEEP_ENABLE,&label) && - !sensors_get_feature(*name,SENSORS_W83781D_BEEP_ENABLE,&cur)) { - print_label(label,10); - if (cur < 0.5) - printf("Sound alarm disabled\n"); - else - printf("Sound alarm enabled\n"); - } else - printf("ERROR: Can't get BEEP data!\n"); + if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_BEEP_ENABLE,&label,&valid) + && valid) { + if (!sensors_get_feature(*name,SENSORS_W83781D_BEEP_ENABLE,&cur)) { + print_label(label,10); + if (cur < 0.5) + printf("Sound alarm disabled\n"); + else + printf("Sound alarm enabled\n"); + } else + printf("ERROR: Can't get BEEP data!\n"); + } free_the_label(&label); }