2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-01 23:05:25 +00:00

fancontrol.pl:

* Disable debugging by default
* Add support for non-i2c drivers
* More tolerant config file parsing (for some reason pwmconfig
  adds unneeded spaces, it should probably be fixed but it's always
  better to be tolrant nevertheless)


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4295 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2007-01-14 15:20:06 +00:00
parent e37c58cccd
commit 0662aaa299
2 changed files with 21 additions and 12 deletions

View File

@@ -32,6 +32,9 @@ SVN HEAD
Programs dump/*: More robust handling of user inputs Programs dump/*: More robust handling of user inputs
Programs pwmconfig, fancontrol: Handle write errors for bash 3.1 Programs pwmconfig, fancontrol: Handle write errors for bash 3.1
Add support for non-i2c drivers Add support for non-i2c drivers
Program fancontrol.pl: Disable debugging by default
Add support for non-i2c drivers
More tolerant config file parsing
Program sensord: Add pc87247 support (fans only) Program sensord: Add pc87247 support (fans only)
Add vt1211 support (#2150) Add vt1211 support (#2150)
Add w83627dhg support (David Holl, #2157) Add w83627dhg support (David Holl, #2157)

View File

@@ -47,15 +47,13 @@ use POSIX;
$ENV{PATH} = "/bin:/usr/bin"; $ENV{PATH} = "/bin:/usr/bin";
##### Configuration ##### ##### Configuration #####
use constant DEBUG => 1; use constant DEBUG => 0;
use constant MAX => 255; use constant MAX => 255;
use constant PIDFILE => '/var/run/fancontrol.pid'; use constant PIDFILE => '/var/run/fancontrol.pid';
use constant CONFFILE => '/etc/fancontrol'; use constant CONFFILE => '/etc/fancontrol';
use constant LOGFILE => '/var/log/fancontrol/fancontrol.log'; use constant LOGFILE => '/var/log/fancontrol/fancontrol.log';
use constant ERRFILE => '/var/log/fancontrol/fancontrol.err'; use constant ERRFILE => '/var/log/fancontrol/fancontrol.err';
use constant SDIR => '/sys/bus/i2c/devices';
### End Configuration ### ### End Configuration ###
our $interval; our $interval;
@@ -119,13 +117,21 @@ our $sysfs = 0;
our $dir = '/proc/sys/dev/sensors'; our $dir = '/proc/sys/dev/sensors';
if (!(-d $dir)) if (!(-d $dir))
{ {
if (!(-d SDIR)) if ($afcpwm[0] =~ m/^hwmon\d/)
{
$dir = '/sys/class/hwmon';
}
else
{
$dir = '/sys/bus/i2c/devices';
}
if (!(-d $dir))
{ die("No sensors found! (are the necessary modules loaded?) : { die("No sensors found! (are the necessary modules loaded?) :
$!\n"); } $!\n"); }
else else
{ {
$sysfs = 1; $sysfs = 1;
$dir = SDIR;
} }
} }
@@ -173,13 +179,13 @@ $minstop);
while($_ = <F>) while($_ = <F>)
{ {
if ($_ =~ /^\s+$/) { next; } if ($_ =~ /^\s+$/) { next; }
elsif ($_ =~ /^INTERVAL=(.*)$/) { $interval = $1; next; } elsif ($_ =~ /^INTERVAL=\s*(.*)$/) { $interval = $1; next; }
elsif ($_ =~ /^FCTEMPS=(.*)$/) { $fctemps = $1; next; } elsif ($_ =~ /^FCTEMPS=\s*(.*)$/) { $fctemps = $1; next; }
elsif ($_ =~ /^FCFANS=(.*)$/) { $fcfans = $1; next; } elsif ($_ =~ /^FCFANS=\s*(.*)$/) { $fcfans = $1; next; }
elsif ($_ =~ /^MINTEMP=(.*)$/) { $mintemp = $1; next; } elsif ($_ =~ /^MINTEMP=\s*(.*)$/) { $mintemp = $1; next; }
elsif ($_ =~ /^MAXTEMP=(.*)$/) { $maxtemp = $1; next; } elsif ($_ =~ /^MAXTEMP=\s*(.*)$/) { $maxtemp = $1; next; }
elsif ($_ =~ /^MINSTART=(.*)$/) { $minstart = $1; next; } elsif ($_ =~ /^MINSTART=\s*(.*)$/) { $minstart = $1; next; }
elsif ($_ =~ /^MINSTOP=(.*)$/) { $minstop = $1; next; } elsif ($_ =~ /^MINSTOP=\s*(.*)$/) { $minstop = $1; next; }
} }
close(F); close(F);