Make /etc/sensors3.conf the default config
PATCH 6/6 Make /etc/sensors3.conf the default config
Use /etc/sensors3.conf as the default configuration file. If it can't be found, fallback to /etc/sensors.conf. This allows for an old libsensors and a new libsensors to be installed in parallel, and each one has its own configuration file.
One important change here is that the default configuration file will be installed as /etc/sensors3.conf by "make install".
--- INSTALL | 2 +- doc/fan-divisors | 4 ++-- etc/Module.mk | 2 +- etc/sensors-conf-convert | 2 +- lib/init.c | 6 +++++- lib/libsensors.3 | 15 ++++++++++++++- lib/sensors.conf.5 | 12 +++++++++++- prog/sensord/sensord.8 | 2 ++ prog/sensors/sensors.1 | 2 ++ 9 files changed, 39 insertions(+), 8 deletions(-)
INSTALL +1 -1
@@ -71,7 +71,7 @@ program to get a report of all detected page for available options. The initial output of `sensors' will not be perfect. You have to adjust -the configuration file (/etc/sensors.conf) to match your motherboard. +the configuration file (/etc/sensors3.conf) to match your motherboard. This includes (re)labelling inputs, ignoring unused inputs, changing voltage compute lines and setting limits. Write down all the sensor information your BIOS displays as a hint to what you are supposed to
doc/fan-divisors +2 -2
@@ -47,7 +47,7 @@ How to change fan divisors -------------------------- Put an entry "set fanN_div X" in the appropriate section of -/etc/sensors.conf and run 'sensors -s' +/etc/sensors3.conf and run 'sensors -s' (N is the number of the fan, and X is the divisor you want).
@@ -87,7 +87,7 @@ outputs 4 pulses by revolution, instead As we learned above, you can _not_ fix this by changing the fan divisor. You must add entries into the appropriate -section of /etc/sensors.conf: +section of /etc/sensors3.conf: compute fanN @/2, 2*@
etc/Module.mk +1 -1
@@ -21,7 +21,7 @@ MODULE_DIR := etc ETCTARGET := $(MODULE_DIR)/sensors.conf.eg -ETCINSTALL := $(ETCDIR)/sensors.conf +ETCINSTALL := $(ETCDIR)/sensors3.conf # No all rule
etc/sensors-conf-convert +1 -1
@@ -367,7 +367,7 @@ BEGIN if (defined $ARGV[0] && ($ARGV[0] eq '-h' || $ARGV[0] eq '--help')) { print "Convert sensors.conf from lm-sensors 2 format to lm-sensors 3 format\n", - "Typical usage: sensors-conf-convert /etc/sensors.conf\n"; + "Typical usage: sensors-conf-convert < /etc/sensors.conf > /etc/sensors3.conf\n"; exit 0; } }
lib/init.c +5 -1
@@ -20,6 +20,7 @@#include <stdlib.h> #include <stdio.h> +#include <errno.h> #include "sensors.h" #include "data.h" #include "error.h"
@@ -29,7 +30,8 @@#include "scanner.h" #include "init.h" -#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" +#define DEFAULT_CONFIG_FILE ETCDIR "/sensors3.conf" +#define ALT_CONFIG_FILE ETCDIR "/sensors.conf"int sensors_init (FILE *input) {
@@ -49,6 +51,8 @@ int sensors_init(FILE *input) }else {/* No configuration provided, use default */ input =fopen (DEFAULT_CONFIG_FILE ,"r" ); +if (!input && errno =ENOENT ) + input =fopen (ALT_CONFIG_FILE ,"r" );if (input) {if (sensors_scanner_init (input) ||sensors_yyparse ()) {
lib/libsensors.3 +14 -1
@@ -24,7 +24,7 @@ .\" .\" References consulted: .\" libsensors source code -.TH libsensors 3 "June 2007" "lm-sensors 3" "Linux Programmer's Manual" +.TH libsensors 3 "October 2007" "lm-sensors 3" "Linux Programmer's Manual" .SH NAME libsensors \- publicly accessible functions provided by the sensors library .SH SYNOPSIS
@@ -57,6 +57,9 @@ value unequal to zero, you are in troubl be initialized properly. If you want to reload the configuration file, call sensors_cleanup() below before calling sensors_init() again. +If FILE is NULL, the default configuration file is used (see the FILES +section below). Most applications will want to do that. + .B void sensors_cleanup(void); .br Clean-up function: You can't access anything after this, until the next sensors_init() call!
@@ -168,6 +171,16 @@ data structures. .br A string representing the version of libsensors. +.SH FILES +.I /etc/sensors3.conf +.br +.I /etc/sensors.conf +.RS +The system-wide +.BR libsensors (3) +configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist, +/etc/sensors.conf is used instead. + .SH SEE ALSO sensors.conf(5)
lib/sensors.conf.5 +11 -1
@@ -23,7 +23,7 @@ .\" .\" References consulted: .\" sensors.conf.eg by Frodo Looijaard -.TH sensors.conf 5 "September 2007" "lm-sensors 3" "Linux User's Manual" +.TH sensors.conf 5 "October 2007" "lm-sensors 3" "Linux User's Manual" .SH NAME sensors.conf \- libsensors configuration file
@@ -394,6 +394,16 @@ the feature is in the same class as the and there is anywhere else a statement for this specific class member, that one takes always precedence. +.SH FILES +.I /etc/sensors3.conf +.br +.I /etc/sensors.conf +.RS +The system-wide +.BR libsensors (3) +configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist, +/etc/sensors.conf is used instead. + .SH SEE ALSO libsensors(3)
prog/sensord/sensord.8 +2 -0
@@ -360,6 +360,8 @@ after which the daemon will exit. Round-robin database support doesn't cope with multiple sensor chips having duplicate sensor labels. .SH FILES +.I /etc/sensors3.conf +.br .I /etc/sensors.conf .RS The system-wide
prog/sensors/sensors.1 +2 -0
@@ -74,6 +74,8 @@ buses of the same type. As bus numbers a over reboots, these statements let you refer to each bus by its name rather than numbers. .SH FILES +.I /etc/sensors3.conf +.br .I /etc/sensors.conf .RS The system wide configuration file. See
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 6/6] Make /etc/sensors3.conf the default
Quoted 5 lines · Jean Delvare
Use
/etc/sensors3.confas the default configuration file. If it can't be found, fallback to/etc/sensors.conf. This allows for an old libsensors and a new libsensors to be installed in parallel, and each one has its own configuration file.
I've reviewed the entire patch set and it looks good to me. you forgot to update the libsensors.3 manpage in patch1, but thats remedied by patch6
Regards,
hans
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 6/6] Make /etc/sensors3.conf the default
In reply to Jean DelvareHi Hans,
Quoted 8 lines · Hans de Goede
Quoted 4 lines · Jean Delvare
Use
/etc/sensors3.confas the default configuration file. If it can't be found, fallback to/etc/sensors.conf. This allows for an old libsensors and a new libsensors to be installed in parallel, and each one has its own configuration file.I've reviewed the entire patch set and it looks good to me. you forgot to update the libsensors.3 manpage in patch1, but thats remedied by patch6
Good point, I've altered the patch series a bit to fix this. Thanks for the review. I'm going to commit this patch series to SVN now.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 6/6] Make /etc/sensors3.conf the default
In reply to Jean DelvareQuoted 9 lines · Jean Delvare
Hi Hans,
Quoted 6 lines · Hans de Goede
Quoted 4 lines · Jean Delvare
Use
/etc/sensors3.confas the default configuration file. If it can't be found, fallback to/etc/sensors.conf. This allows for an old libsensors and a new libsensors to be installed in parallel, and each one has its own configuration file.
Quoted 5 lines
Quoted 2 lines
I've reviewed the entire patch set and it looks good to me. you forgot to update the libsensors.3 manpage in patch1, but thats remedied by patch6
Good point, I've altered the patch series a bit to fix this. Thanks for the review. I'm going to commit this patch series to SVN now.
Committed now. I guess we'll need to have a RC3 after that, to make sure I didn't break anything.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors