automatic commit
authorFrancois Fleuret <fleuret@moose.fleuret.org>
Sun, 7 Dec 2008 12:43:30 +0000 (13:43 +0100)
committerFrancois Fleuret <fleuret@moose.fleuret.org>
Sun, 7 Dec 2008 12:43:30 +0000 (13:43 +0100)
README.txt
breezed.1
breezed.cc
breezed_Lenovo_X61s.conf

index 1434303..2ea29b2 100644 (file)
 
    You must have a configuration file in /etc/breezed.conf. Only one
    is currently provided in the archive, and it corresponds to the
 
    You must have a configuration file in /etc/breezed.conf. Only one
    is currently provided in the archive, and it corresponds to the
-   settings _I_ picked for _my_ Lenovo X61s.
+   settings _I_ picked for _my_ Lenovo X61s. I have no idea if these
+   settings are safe on this laptop (I guess so, since I have been
+   using them for a few months now and it works perfectly), and I
+   suspect they are not safe for another laptop.
 
 
-   I have no idea if these settings are safe on this laptop (I guess
-   so, since I have been using them for a few months now and it works
-   perfectly), and I suspect they are not safe for another laptop.
-
- * ALGORITHM
-
-   Breezed scans the temperatures every 5s and sets the fan speed
-   according to a series of thresholds.
-
-   Unfortunately, if the fan speed is set directly according to these
-   temperature thresholds, it creates oscillations: The fan goes up,
-   temperature goes down, hence fan goes down, temperature goes up,
-   etc.
-
-   To mitigate such phenomenons, the daemon waits at least 30s after
-   the last change before reducing the fan speed, and the actual
-   thresholds to decrease the fan speed are two degrees below the
-   provided thresholds, which are used when increasing the fan
-   speed. This creates a stability area of two degrees, which seems to
-   be enough. Please let me know if you have problem with the
-   resulting overall behavior.
-
-   See the man page for details about the arguments and configuration
-   file.
+   See the man page for details about the algorithm, arguments and
+   configuration file.
 
  * NOTES
 
 
  * NOTES
 
-   I wrote this daemon for my personal usage on a X61s, and using it
-   may damage your hardware.
-
    On Thinkpads you have to allow the module thinkpad_acpi to set the
    fan speed, which is not allowed by default in Debian. To do so, you
    have to have a file /etc/modprobe.d/thinkpad_acpi.modprobe
    On Thinkpads you have to allow the module thinkpad_acpi to set the
    fan speed, which is not allowed by default in Debian. To do so, you
    have to have a file /etc/modprobe.d/thinkpad_acpi.modprobe
index 2f01520..7a7e3bd 100644 (file)
--- a/breezed.1
+++ b/breezed.1
@@ -6,38 +6,40 @@ breezed - Fan control daemon
 \fBbreezed\fP [\fBoptions\fP]
 .SH "DESCRIPTION"
 .PP
 \fBbreezed\fP [\fBoptions\fP]
 .SH "DESCRIPTION"
 .PP
-\fBbreezed\fP Adjusts the fan speed according to the computer
-temperature. It should be started through the adequate script in
-/etc/rc?.d.
+\fBbreezed\fP is a daemon to adjust the fan speed according to the
+computer temperature. It should be started through the adequate script
+in /etc/rc?.d.
 
 
-Every 5s, this daemon gathers all integer values from the thermal
-files, and keep the max as the overall computer temperature T. It then
-pick the highest temperature threshold lower than T and set the fan
-speed to the corresponding level. To avoid oscillations, T has to be
-two degrees below threshold to reduce the temperature. Also, the
-daemon waits for at least 30s after any change of the fan speed before
-reducing it. The fan speed is set by writing "level %d" into the
-specified fan file.
+Every 5s, \fBbreezed\fP gathers all integer values from the thermal
+files, and takes the max as the overall temperature T. It then
+computes the highest fan speed whose temperature threshold is lower
+than T. If that speed is above the current speed, the daemon changes
+the fan speed accordingly. Otherwise it computes the lowest fan speed
+whose temperature threshold is two degrees above T, and sets the fan
+speed one level below. This two degree gap avoids too many
+oscillations. Also, the daemon waits for at least 30s after any change
+of the fan speed before reducing it. The fan speed is set by writing
+"level <level>" into the specified fan file.
 
 Options can not be specified twice, neither on the command line nor in
 the configuration file.
 
 .SH "OPTIONS"
 
 Options can not be specified twice, neither on the command line nor in
 the configuration file.
 
 .SH "OPTIONS"
-.IP "\fB-h | --help\fP         " 10
+.IP "\fB-h | --help\fP" 10
 display help and exits
 display help and exits
-.IP "\fB-v | --version\fP " 10
+.IP "\fB-v | --version\fP" 10
 display the version number and exits
 display the version number and exits
-.IP "\fB-d | --debug\fP " 10
+.IP "\fB-d | --debug\fP" 10
 run in verbose mode
 run in verbose mode
-.IP "\fB-cf | --configuration-file <file>\fP " 10
+.IP "\fB-cf | --configuration-file <file>\fP" 10
 set the configuration file (default is /etc/breezed.conf)
 set the configuration file (default is /etc/breezed.conf)
-.IP "\fB-ncf | --no-configuration-file\fP " 10
+.IP "\fB-ncf | --no-configuration-file\fP" 10
 prevent the reading of a configuration file
 prevent the reading of a configuration file
-.IP "\fB-tf | --thermal-file <file1>[,file2]...\fP " 10
+.IP "\fB-tf | --thermal-file <file1>[,file2]...\fP" 10
 set the files to spool for temperatures.
 set the files to spool for temperatures.
-.IP "\fB-ff | --fan-file <file>\fP " 10
+.IP "\fB-ff | --fan-file <file>\fP" 10
 set the file to control the fan speed.
 set the file to control the fan speed.
-.IP "\fB-tt | --temperature-thresholds <temp1>[,temp2]...\fP " 10
+.IP "\fB-tt | --temperature-thresholds <temp1>[,temp2]...\fP" 10
 set the temperature thresholds.
 
 .SH "CONFIGURATION FILE"
 set the temperature thresholds.
 
 .SH "CONFIGURATION FILE"
@@ -54,7 +56,7 @@ A typical way of starting breezed is
 
 breezed --thermal-files /proc/acpi/thermal_zone/THM0/temperature,/proc/acpi/thermal_zone/THM1/temperature \
  --fan-file /proc/acpi/ibm/fan \
 
 breezed --thermal-files /proc/acpi/thermal_zone/THM0/temperature,/proc/acpi/thermal_zone/THM1/temperature \
  --fan-file /proc/acpi/ibm/fan \
- --temperature-thresholds -1,52,54,56,58,60,62,64
+ --temperature-thresholds 52,54,56,58,60,62,64
 
 which specifies that when the temperature raises above 52C, the fan
 level should be 1, when the temperature raises above 54C it should be
 
 which specifies that when the temperature raises above 52C, the fan
 level should be 1, when the temperature raises above 54C it should be
index 19e500c..6f079b2 100644 (file)
@@ -61,7 +61,7 @@ int last_level = -1;
 
 int file_fan_fd;
 
 
 int file_fan_fd;
 
-int nb_temperature_thresholds = 0;
+int nb_temperature_thresholds;
 int *temperature_thresholds = 0;
 
 int nb_file_thermal = 0;
 int *temperature_thresholds = 0;
 
 int nb_file_thermal = 0;
@@ -148,6 +148,8 @@ void define_temperature_thresholds(char *definition) {
     exit(1);
   }
 
     exit(1);
   }
 
+  nb_temperature_thresholds = 1;
+
   char *s;
   s = definition;
   while(s) {
   char *s;
   s = definition;
   while(s) {
@@ -157,8 +159,10 @@ void define_temperature_thresholds(char *definition) {
 
   temperature_thresholds = new int[nb_temperature_thresholds];
 
 
   temperature_thresholds = new int[nb_temperature_thresholds];
 
+  temperature_thresholds[0] = -1;
+
   s = definition;
   s = definition;
-  int k = 0;
+  int k = 1;
   while(s) {
     s = next_word(token, s, buffer_size);
     temperature_thresholds[k] = atoi(token);
   while(s) {
     s = next_word(token, s, buffer_size);
     temperature_thresholds[k] = atoi(token);
@@ -170,8 +174,6 @@ void define_temperature_thresholds(char *definition) {
     }
     k++;
   }
     }
     k++;
   }
-
-  temperature_thresholds[0] = -1;
 }
 
 //////////////////////////////////////////////////////////////////////
 }
 
 //////////////////////////////////////////////////////////////////////
index 538e858..c4a5ba4 100644 (file)
@@ -6,4 +6,4 @@
 
 thermal_files /proc/acpi/thermal_zone/THM0/temperature /proc/acpi/thermal_zone/THM1/temperature
 fan_file /proc/acpi/ibm/fan
 
 thermal_files /proc/acpi/thermal_zone/THM0/temperature /proc/acpi/thermal_zone/THM1/temperature
 fan_file /proc/acpi/ibm/fan
-temperature_thresholds -1,52,54,56,58,60,62,64
+temperature_thresholds 52,54,56,58,60,62,64