<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vm</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vm"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Vm"/>
	<updated>2026-05-05T00:54:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=48061</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=48061"/>
		<updated>2010-04-03T02:32:49Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Just released version 0.7, which now allows a more fine-grained control over temperature limits.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://sourceforge.net/projects/thinkfan/&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=43566</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=43566"/>
		<updated>2009-06-26T22:11:35Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. For Gentoo users there's an ebuild and an initscript. Just released version 0.5, which now supports any hardware through the sysfs hwmon interface.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://phuk.ath.cx:3080/thinkfan/?C=M;O=D&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=41662</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=41662"/>
		<updated>2009-02-25T12:02:44Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://phuk.ath.cx:3080/thinkfan/?C=M;O=D&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=41661</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=41661"/>
		<updated>2009-02-25T11:46:54Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://phuk.ath.cx:3080/thinkfan/thinkfan-latest.tar.bz2&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Problem_with_display_remaining_black_after_resume&amp;diff=40823</id>
		<title>Problem with display remaining black after resume</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Problem_with_display_remaining_black_after_resume&amp;diff=40823"/>
		<updated>2009-01-21T06:18:26Z</updated>

		<summary type="html">&lt;p&gt;Vm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There has been a problem encountered where the display stays black on resuming from suspend.&lt;br /&gt;
&lt;br /&gt;
The symptom might have you think first that your system hang up, but you will realize that your ThinkPad works and you can even reset it via {{key|Ctrl}}{{key|Alt}}{{key|Del}}.&lt;br /&gt;
&lt;br /&gt;
==Affected Models==&lt;br /&gt;
*ThinkPad {{T41p}}, {{T42}}, {{T42p}}, {{T43}}, {{T43p}}, {{T60}}, {{T60p}}, {{T61p}}&lt;br /&gt;
*Thinkpad {{T23}}&lt;br /&gt;
*ThinkPad {{X21}}, {{X30}}, {{X31}}, {{X40}}, {{X41}}&lt;br /&gt;
*ThinkPad {{R31}}, {{R50e}}{{footnote|1}}, {{R50p}}, {{R51}} (with BIOS 1.11), {{R52}}, {{R60}}, {{R61}}&lt;br /&gt;
*ThinkPad {{A30p}}&lt;br /&gt;
*ThinkPad {{390X}} (doesn't wake up; LCD backlight on, harddrive light remains on)&lt;br /&gt;
*ThinkPad {{Z60t}}, {{Z60m}}, {{Z61m}}, {{Z61e}}&lt;br /&gt;
*ThinkPad {{X60s}}, {{X60}}, {{X61}}, {{X61s}}, {{X200}}&lt;br /&gt;
&lt;br /&gt;
==Affected Operating Systems==&lt;br /&gt;
*Linux (it's a kernel issue)&lt;br /&gt;
*FreeBSD (6.x at least)&lt;br /&gt;
&lt;br /&gt;
==Solutions==&lt;br /&gt;
===Quick workaround for R61i, T23, maybe others===&lt;br /&gt;
Try pressing CTRL+ALT+F1 to switch to text console. The backlight should come on normally. Press CTRL+ALT+F7 to return to X.&lt;br /&gt;
&lt;br /&gt;
On a T23 using Ubuntu Feisty, pressing Fn+F7 (external/internal display change) once or twice brought the display back.  After upgrading to Ubuntu Gutsy it doesn't work anymore, but pressing Fn+F3 (blank screen) and Fn (restore display) works.&lt;br /&gt;
&lt;br /&gt;
===Quick Workaround for R61 (at least 8918-5QG) using NVidia===&lt;br /&gt;
&lt;br /&gt;
Use Vesa driver instead of the proprietary NVidia driver.&lt;br /&gt;
&lt;br /&gt;
===Pseudo-solution for R61===&lt;br /&gt;
On an R61 running Fedora Core 9, the nv driver fails to turn the backlight on after resuming from a suspend to RAM. I fixed this by using the proprietary NVIDIA Linux drivers (v177.82).&lt;br /&gt;
&lt;br /&gt;
=== Solution for ThinkPad Z60t ===&lt;br /&gt;
&lt;br /&gt;
* '''Display controller:''' Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)&lt;br /&gt;
* '''Distro:''' Fedora release 7 (Moonshine)&lt;br /&gt;
* '''Kernel:''' Linux 2.6.22.5-76.fc7&lt;br /&gt;
&lt;br /&gt;
The solution is straight forward - just to add configuration parameter for the default '''pm-utils''' package. Create file &amp;lt;code&amp;gt;/etc/pm/config.d/config&amp;lt;/code&amp;gt; and put there one line &amp;lt;code&amp;gt;DISPLAY_QUIRK_S3_BIOS=&amp;quot;true&amp;quot;&amp;lt;/code&amp;gt;, or execute following command:&lt;br /&gt;
&lt;br /&gt;
 echo DISPLAY_QUIRK_S3_BIOS=\&amp;quot;true\&amp;quot; &amp;gt;&amp;gt; /etc/pm/config.d/config&lt;br /&gt;
&lt;br /&gt;
===Semi-Solution for ThinkPad X60 with damaged system after s2ram usage===&lt;br /&gt;
It happend when restarting a s2ram-session.&lt;br /&gt;
&lt;br /&gt;
'''Symptom:''' Black screen with blinking &amp;quot;_&amp;quot; sign remaind. (without the &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
'''System status:''' HDD idle, fan running, everything else looks to wait for something to happen.&lt;br /&gt;
&lt;br /&gt;
'''Semi-Solution:''' Booting with DVD-ROM and going through the installations menu,&lt;br /&gt;
where you choose &amp;quot;other&amp;quot; and &amp;quot;boot a installed system&amp;quot; (something like that). Gladly it works,&lt;br /&gt;
and OpenSuSE 10.1 comes up with 50% &amp;quot;failed&amp;quot; messages! I than shutdown properly, rebooted again&lt;br /&gt;
and had 100% &amp;quot;done&amp;quot; again, with no other things affected.&lt;br /&gt;
&lt;br /&gt;
'''Further:''' Repairing with the DVD-ROM crashed massivly(!), so I selected &amp;quot;boot a installed system&amp;quot; as final&lt;br /&gt;
solution and it worked!&lt;br /&gt;
&lt;br /&gt;
'''Unknown:''' Maybe the Solution for ThinkPads with 1400x1050 internal LCD and Intel 915GM will help,&lt;br /&gt;
because X60s and X60 are very familiar. (Not tested so far.)&lt;br /&gt;
&lt;br /&gt;
(If this Problem is not right here, please edit and move.)&lt;br /&gt;
&lt;br /&gt;
===Solution for ThinkPads with 1400x1050 internal LCD and Intel 915GM ===&lt;br /&gt;
see [[1400x1050 on Intel 915GM]].&lt;br /&gt;
===Solution for ThinkPads with ATI graphic chips and Intel 915/945GM ===&lt;br /&gt;
&lt;br /&gt;
Affected models include {{X60s}}, {{X200s}}, {{R60}} and {{T60}}.&lt;br /&gt;
&lt;br /&gt;
This soluton also applies to T42 with Intel 855 and ATI 9600 M10.&lt;br /&gt;
&lt;br /&gt;
One solution may be to provide the {{bootparm|acpi_sleep|s3_bios}} kernel parameter in your kernel parameter line.&lt;br /&gt;
&lt;br /&gt;
For grub this would look like this:&lt;br /&gt;
&lt;br /&gt;
 title           Linux, kernel 2.6.11-1-686&lt;br /&gt;
 root            (hd0,0)&lt;br /&gt;
 kernel          /boot/vmlinuz-2.6.11-1-686 root=/dev/hda1 ro acpi_sleep=s3_bios&lt;br /&gt;
 initrd          /boot/initrd.img-2.6.11-1-686&lt;br /&gt;
 savedefault&lt;br /&gt;
 boot&lt;br /&gt;
&lt;br /&gt;
For lilo it would look like this:&lt;br /&gt;
&lt;br /&gt;
 image=/boot/vmlinuz&lt;br /&gt;
     append=&amp;quot;acpi_sleep=s3_bios&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The actual process of going to sleep is then managed through a sleep script; as a start, see the {{path|sleep.sh}} script in the Extreme Graphics 2 section below, but note the following comments:&lt;br /&gt;
&lt;br /&gt;
In [[:Category:OpenSUSE|OpenSUSE]] 10.1 (at least on a T43p), it's necessary to override the default options for s2ram if you're using the newer ATI driver.  This can be done putting {{bootparm|SUSPEND2RAM_FORCE|&amp;quot;yes&amp;quot;}} and {{bootparm|SUSPEND2RAM_ACPI_SLEEP|&amp;quot;3&amp;quot;}} in {{path|/etc/powersave/sleep}}.&lt;br /&gt;
&lt;br /&gt;
In {{Ubuntu}} or {{Kubuntu}}, it may be necessary to modify {{path|/etc/default/acpi-support}}.  In that file, make sure that {{path|ACPI_SLEEP}} is uncommented and set to true.  With ATI chips, also make sure that {{path|SAVE_VBE_STATE}} is uncommented and set to true; with Intel chips, on the other hand, ensure that nothing is done with respect to VBE--no reposts, no state saves. Also commenting POST_VIDEO may help. &lt;br /&gt;
&lt;br /&gt;
In {{Fedora}}, it may be necessary with the Intel chips to edit the {{path|resume_video()}} function in {{path|/etc/pm/functions-intel}} to comment out the VBE post and restore.  (As of FC6 these seem to be pre-commented out.)  Also, the laptop, after waking up, may go back to sleep immediately or whenever the AC adapter is disconnected.  When this happens, it's caused by a bug in the HAL daemon that incorrectly reports certain ACPI events.  This is a known problem and a simple workaround is described [http://live.gnome.org/GnomePowerManager/Faq#head-b8b1280115b0a51c2cc27b13a57121130ebf36cb here].&lt;br /&gt;
&lt;br /&gt;
{{NOTE|It is possible this method will not work if the laptop is docked.  It is also possible that the cited workaround for the HAL daemon bug will not work on some machines.  A kludgier workaround in this event is to kill the HAL daemon on suspend.  This necessitates the resuscitation of GPM upon resume.}}&lt;br /&gt;
&lt;br /&gt;
Another solution is to use vbetool. If you are using {{Debian}} with the hibernate package, uncomment &amp;quot;EnableVbetool yes&amp;quot; in {{path|/etc/hibernate/hibernate.conf}} (or {{path|/etc/hibernate/ram.conf}}).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
On '''T60 2007-CTO''' (Core2Duo 2Ghz, 2GB Ram, ATI X1400) the screen stayed blank after suspend-to-ram until I set '''vga=0''' in lilo.conf.&lt;br /&gt;
&lt;br /&gt;
Working config:&lt;br /&gt;
 Linux 2.6.21.5&lt;br /&gt;
 fglrx 8.37.6&lt;br /&gt;
 debian etch:&lt;br /&gt;
  powersaved 0.14.0-5:&lt;br /&gt;
   UNLOAD_MODULES_BEFORE_SUSPEND2DISK=&amp;quot;usb_storage ohci_hcd uhci_hcd ehci_hcd ipw3945 pcmcia yenta_socket rsrc_nonstatic pcmcia_core&amp;quot;&lt;br /&gt;
   UNLOAD_MODULES_BEFORE_SUSPEND2RAM=&amp;quot;usb_storage ohci_hcd uhci_hcd ehci_hcd ipw3945 pcmcia yenta_socket rsrc_nonstatic pcmcia_core&amp;quot;   &lt;br /&gt;
  hibernate:&lt;br /&gt;
   SwitchToTextMode yes&lt;br /&gt;
  lilo.conf:&lt;br /&gt;
   vga=0&lt;br /&gt;
&lt;br /&gt;
&amp;quot;EnableVbetool yes&amp;quot; and other suggestions didn't work for me.&lt;br /&gt;
&lt;br /&gt;
For suspend-to-disk, don't load fglrx in initrd.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
On '''T60-20076RG''' (Core2Duo 2GHz, ATI X1400) with {{OpenSUSE}} 11.1 and fglrx 8-12 the following had to be done to get suspend to RAM always resume:&lt;br /&gt;
* Add {{bootparm|S2RAM_QUIRKS_SOURCE|&amp;quot;s2ram&amp;quot;}} to file {{path|/etc/pm/config.d/config}}&lt;br /&gt;
* Create an executable script {{path|/etc/pm/sleep.d/00text}} containing:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
         hibernate|suspend)&lt;br /&gt;
                 /bin/chvt 1&lt;br /&gt;
                 ;;&lt;br /&gt;
         thaw|resume)&lt;br /&gt;
                 /bin/chvt 7&lt;br /&gt;
                 ;;&lt;br /&gt;
 esac&lt;br /&gt;
&lt;br /&gt;
There seems to be a bug ([https://bugzilla.novell.com/show_bug.cgi?id=463434 Novell bugzilla]) which makes it impossible for s2ram to switch to text console while suspending through pm-suspend. The script above forces console change. Along with setting s2ram as quirks source (which makes it correctly set acpi_bios before suspend - to s3_bios,s3_mode&lt;br /&gt;
for T60 2007*) this can make resume work flawlessly despite using vesafb.&lt;br /&gt;
&lt;br /&gt;
===Solution for ThinkPads with Intel Extreme Graphics 2===&lt;br /&gt;
{{NOTE|&lt;br /&gt;
On [[:Category:X40|X40]]s/[[:Category:X41|X41]]s - even with Intel Extreme Graphics - and for [[:Category:R52|R52]]s with Intel Graphics Media Accelerator 900 the [[Problem with display remaining black after resume#Solution for ThinkPads with ATI graphic chips|solution for ATI graphics chips]] above is reported to work. In this case, make sure no changes to VBE are made, especially no state saves and no reposts.}}&lt;br /&gt;
&lt;br /&gt;
The following solution should work on 865G, 865GV, 855GM, 855GME, 852GME chipsets.&lt;br /&gt;
*First of all, '''do not''' use the {{bootparm|acpi_sleep|s3_bios}} kernel parameter.&lt;br /&gt;
*Second, completely remove framebuffer support from your kernel. If it's built as modules, it is important that they do not get loaded at all.&lt;br /&gt;
*Before suspending, change to a console and safe the video state with {{cmdroot|cat /proc/bus/pci/00/02.0 &amp;gt; /tmp/video_state}}.&lt;br /&gt;
*On resume, restore the video state with {{cmdroot|cat /tmp/video_state &amp;gt; /proc/bus/pci/00/02.0}} and change back to X.&lt;br /&gt;
*For Debian Etch 4.0 on R50e just make following changes to /etc/default/acpi-support:&lt;br /&gt;
 #SAVE_VBE_STATE=true&lt;br /&gt;
 #VBESTATE=/var/lib/acpi-support/vbestate&lt;br /&gt;
 #POST_VIDEO=true&lt;br /&gt;
 SAVE_VIDEO_PCI_STATE=true&lt;br /&gt;
&lt;br /&gt;
*For a R50e the only thing needed to make suspend to ram work in Ubuntu 6.06 is adding&lt;br /&gt;
 Option  &amp;quot;VBERestore&amp;quot; &amp;quot;yes&amp;quot;&lt;br /&gt;
to the &amp;lt;tt&amp;gt;Device&amp;lt;/tt&amp;gt; section in your {{path|/etc/X11/xorg.conf}}, and the example script below.&lt;br /&gt;
&lt;br /&gt;
The following example {{path|/etc/acpi/actions/sleep.sh}} script shows how to integrate the according lines.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 # change to console 1&lt;br /&gt;
 FGCONSOLE=`fgconsole`&lt;br /&gt;
 chvt 6&lt;br /&gt;
 &lt;br /&gt;
 # safe video state&lt;br /&gt;
 cat /proc/bus/pci/00/02.0 &amp;gt; /tmp/video_state&lt;br /&gt;
 &lt;br /&gt;
 # sync filesystem&lt;br /&gt;
 sync&lt;br /&gt;
 &lt;br /&gt;
 # sync hardware clock with system time&lt;br /&gt;
 hwclock --systohc&lt;br /&gt;
 &lt;br /&gt;
 # go to sleep&lt;br /&gt;
 echo -n 3 &amp;gt; /proc/acpi/sleep&lt;br /&gt;
 &lt;br /&gt;
 # waking up&lt;br /&gt;
 # restore system clock&lt;br /&gt;
 hwclock --hctosys&lt;br /&gt;
 &lt;br /&gt;
 # restore video state&lt;br /&gt;
 cat /tmp/video_state &amp;gt; /proc/bus/pci/00/02.0&lt;br /&gt;
 &lt;br /&gt;
 # change back to X&lt;br /&gt;
 chvt $FGCONSOLE&lt;br /&gt;
 &lt;br /&gt;
 # clean up behind us&lt;br /&gt;
 rm /tmp/video_state&lt;br /&gt;
&lt;br /&gt;
With Ubuntu 6.10 on a [[:Category:R51|R51 (2887-32G)]] I ''just'' (as none of the other tricks above) had to add {{bootparm|fb|false}} to the kernel line in {{path|/etc/grub/menu.lst}} and edit {{path|/etc/defaults/acpi-support}} this way:&lt;br /&gt;
&lt;br /&gt;
 SAVE_VBE_STATE=false&lt;br /&gt;
 POST_VIDEO=false&lt;br /&gt;
 SAVE_VIDEO_PCI_STATE=true&lt;br /&gt;
 USE_DPMS=false&lt;br /&gt;
 DOUBLE_CONSOLE_SWITCH=false&lt;br /&gt;
&lt;br /&gt;
===Solution for ThinkPads with Intel I830 Chipset===&lt;br /&gt;
The following solution worked for me on an X30 with I830M chipset with kernel &amp;gt;= 2.6.16.&lt;br /&gt;
*this works with vesafb and also with intelfb frambuffer support.&lt;br /&gt;
The following example {{path|/etc/acpi/actions/sleep.sh}} script shows how to integrate the according lines.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 FGCONSOLE=`fgconsole`&lt;br /&gt;
 chvt 8&lt;br /&gt;
 sync&lt;br /&gt;
 hwclock --systohc&lt;br /&gt;
 &lt;br /&gt;
 echo -n &amp;quot;mem&amp;quot; &amp;gt; /sys/power/state&lt;br /&gt;
 &lt;br /&gt;
 hwclock --hctosys&lt;br /&gt;
 vbetool post&lt;br /&gt;
 &lt;br /&gt;
 if [ &amp;quot;$FGCONSOLE&amp;quot; -ge &amp;quot;7&amp;quot; ] ; then&lt;br /&gt;
   chvt $FGCONSOLE&lt;br /&gt;
 else&lt;br /&gt;
   chvt 7&lt;br /&gt;
   chvt $FGCONSOLE&lt;br /&gt;
 fi&lt;br /&gt;
===Solution for ThinkPads with ATI graphic (and possibly other) chips and FreeBSD===&lt;br /&gt;
&lt;br /&gt;
The FreeBSD acpi(4) manpage mentions a tunable parameter, &amp;quot;hw.acpi.reset_video&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    hw.acpi.reset_video&lt;br /&gt;
             Reset the video adapter from real mode during the resume path.&lt;br /&gt;
             Some systems need this help, others have display problems if it&lt;br /&gt;
             is enabled.  Default is 0 (disabled).&lt;br /&gt;
&lt;br /&gt;
This tunable can be set by adding the following line to your FreeBSD machine's /boot/loader.conf file:&lt;br /&gt;
&lt;br /&gt;
    hw.acpi.reset_video=&amp;quot;1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And rebooting your machine.  Hopefully, the next time you resume from a suspend, you'll see your video again.  This solution doesn't appear to be specific to ATI hardware in any way, so I presume it would be helpful for video chipsets other than ATI, as well.&lt;br /&gt;
&lt;br /&gt;
If this entry doesn't help you, you might consider searching in the [http://lists.freebsd.org/pipermail/freebsd-mobile/ FreeBSD-Mobile email-list archive] for more insight.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{footnotes|&lt;br /&gt;
#If you have this problem with R50e and the above solution doesn't work, try switching to console first. An example sleep script can be found [[How to configure acpid|here]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Solution using s2ram for Intel 915/945GM===&lt;br /&gt;
&lt;br /&gt;
Just using the &amp;quot;s2ram -f -p&amp;quot; command from the uswsusp package will work from within X, at least on a {{Z61e}}. On {{X60s}} it is enough to issue the &amp;quot;s2ram&amp;quot; command and it works. On {{X61}} &amp;quot;s2ram -f -a 1&amp;quot; can work properly. Best idea seems to be to put this into the corresponding acpi script:&lt;br /&gt;
&lt;br /&gt;
 % cat /etc/acpi/sleep.sh &lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 test -f /usr/share/acpi-support/power-funcs || exit 0&lt;br /&gt;
 test -f /usr/sbin/s2ram || exit 0&lt;br /&gt;
 rmmod usb_storage&lt;br /&gt;
 rmmod uhci_hcd&lt;br /&gt;
 rmmod ehci_hcd&lt;br /&gt;
 /usr/sbin/s2ram -f -a 1 -m&lt;br /&gt;
 modprobe uhci_hcd&lt;br /&gt;
 modprobe ehci_hcd&lt;br /&gt;
 modprobe usb_storage&lt;br /&gt;
&lt;br /&gt;
Source: [http://d.hatena.ne.jp/conceal-rs/20080309/1205083315 http://d.hatena.ne.jp/conceal-rs/20080309/1205083315]&lt;br /&gt;
Works on my X61.&lt;br /&gt;
&lt;br /&gt;
===Solution using DOUBLE_CONSOLE_SWITCH===&lt;br /&gt;
&lt;br /&gt;
By setting the following in {{path|/etc/default/acpi-support}} the display comes back on {{X61s}} using Intel chipset:&lt;br /&gt;
&lt;br /&gt;
     DOUBLE_CONSOLE_SWITCH=true&lt;br /&gt;
&lt;br /&gt;
Fedora 8 doesn't have DOUBLE_CONSOLE_SWITCH, but it works when one does:  First, add option &amp;quot;VBERestore&amp;quot; &amp;quot;true&amp;quot; to /etc/X11/xorg.conf&lt;br /&gt;
&lt;br /&gt;
    Section &amp;quot;Device&amp;quot;&lt;br /&gt;
        Identifier  &amp;quot;Videocard0&amp;quot;&lt;br /&gt;
        Driver      &amp;quot;intel&amp;quot;&lt;br /&gt;
        Option      &amp;quot;VBERestore&amp;quot;  &amp;quot;true&amp;quot; &lt;br /&gt;
    EndSection&lt;br /&gt;
&lt;br /&gt;
Then suspends with&lt;br /&gt;
&lt;br /&gt;
    pm-suspend --quirk-vbemode-restore --quirk-s3-bios&lt;br /&gt;
&lt;br /&gt;
===Solution for nvidia-drivers-180* series===&lt;br /&gt;
&lt;br /&gt;
The proprietary NVidia drivers of the 180 series introduce several problems with suspend to ram:&lt;br /&gt;
&lt;br /&gt;
* Situation 1: Suspend from console, '''no''' X-Server running:&amp;lt;br/&amp;gt;&lt;br /&gt;
You need to use vbetool to save and restore the vbestate.&lt;br /&gt;
When using hibernate-script, this can be done by setting the following config variables:&lt;br /&gt;
 EnableVbetool yes&lt;br /&gt;
 RestoreVbeStateFrom /var/lib/vbetool/vbestate&lt;br /&gt;
 VbetoolPost yes&lt;br /&gt;
&lt;br /&gt;
You may need to run &amp;lt;code&amp;gt;mkdir -p /var/lib/vbetool &amp;amp;&amp;amp; vbetool vbestate save &amp;gt; /var/lib/vbetool/vbestate&amp;lt;/code&amp;gt; first.&lt;br /&gt;
&lt;br /&gt;
* Situation 2: Suspend from running X-Server:&amp;lt;br/&amp;gt;&lt;br /&gt;
You '''cannot''' use vbetool or any other quirks, since it seems to confuse the nvidia X driver. That means you should enter S3 simply by doing &amp;lt;code&amp;gt;echo mem &amp;gt; /sys/power/state&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you have your hotkeys handled by acpid, you might differentiate those two cases by checking for a running X process in your hotkey handler (i.e. &amp;lt;code&amp;gt;/etc/acpid/default.sh&amp;lt;/code&amp;gt;):&lt;br /&gt;
 pgrep -x X &amp;gt; /dev/null \          # checks for running process with name &amp;quot;X&amp;quot;&lt;br /&gt;
  &amp;amp;&amp;amp; echo mem &amp;gt; /sys/power/state   # if found, do plain S3 suspend&lt;br /&gt;
  || hibernate-ram                 # otherwise, run quirked script&lt;br /&gt;
&lt;br /&gt;
Furthermore, it seems to be a good idea to use the 180 series with a 2.6.28* kernel.&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Problem_with_display_remaining_black_after_resume&amp;diff=40822</id>
		<title>Problem with display remaining black after resume</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Problem_with_display_remaining_black_after_resume&amp;diff=40822"/>
		<updated>2009-01-21T05:59:29Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* Affected Models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There has been a problem encountered where the display stays black on resuming from suspend.&lt;br /&gt;
&lt;br /&gt;
The symptom might have you think first that your system hang up, but you will realize that your ThinkPad works and you can even reset it via {{key|Ctrl}}{{key|Alt}}{{key|Del}}.&lt;br /&gt;
&lt;br /&gt;
==Affected Models==&lt;br /&gt;
*ThinkPad {{T41p}}, {{T42}}, {{T42p}}, {{T43}}, {{T43p}}, {{T60}}, {{T60p}}, {{T61p}}&lt;br /&gt;
*Thinkpad {{T23}}&lt;br /&gt;
*ThinkPad {{X21}}, {{X30}}, {{X31}}, {{X40}}, {{X41}}&lt;br /&gt;
*ThinkPad {{R31}}, {{R50e}}{{footnote|1}}, {{R50p}}, {{R51}} (with BIOS 1.11), {{R52}}, {{R60}}, {{R61}}&lt;br /&gt;
*ThinkPad {{A30p}}&lt;br /&gt;
*ThinkPad {{390X}} (doesn't wake up; LCD backlight on, harddrive light remains on)&lt;br /&gt;
*ThinkPad {{Z60t}}, {{Z60m}}, {{Z61m}}, {{Z61e}}&lt;br /&gt;
*ThinkPad {{X60s}}, {{X60}}, {{X61}}, {{X61s}}, {{X200}}&lt;br /&gt;
&lt;br /&gt;
==Affected Operating Systems==&lt;br /&gt;
*Linux (it's a kernel issue)&lt;br /&gt;
*FreeBSD (6.x at least)&lt;br /&gt;
&lt;br /&gt;
==Solutions==&lt;br /&gt;
===Quick workaround for R61i, T23, maybe others===&lt;br /&gt;
Try pressing CTRL+ALT+F1 to switch to text console. The backlight should come on normally. Press CTRL+ALT+F7 to return to X.&lt;br /&gt;
&lt;br /&gt;
On a T23 using Ubuntu Feisty, pressing Fn+F7 (external/internal display change) once or twice brought the display back.  After upgrading to Ubuntu Gutsy it doesn't work anymore, but pressing Fn+F3 (blank screen) and Fn (restore display) works.&lt;br /&gt;
&lt;br /&gt;
===Quick Workaround for R61 (at least 8918-5QG) using NVidia===&lt;br /&gt;
&lt;br /&gt;
Use Vesa driver instead of the proprietary NVidia driver.&lt;br /&gt;
&lt;br /&gt;
===Pseudo-solution for R61===&lt;br /&gt;
On an R61 running Fedora Core 9, the nv driver fails to turn the backlight on after resuming from a suspend to RAM. I fixed this by using the proprietary NVIDIA Linux drivers (v177.82).&lt;br /&gt;
&lt;br /&gt;
=== Solution for ThinkPad Z60t ===&lt;br /&gt;
&lt;br /&gt;
* '''Display controller:''' Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)&lt;br /&gt;
* '''Distro:''' Fedora release 7 (Moonshine)&lt;br /&gt;
* '''Kernel:''' Linux 2.6.22.5-76.fc7&lt;br /&gt;
&lt;br /&gt;
The solution is straight forward - just to add configuration parameter for the default '''pm-utils''' package. Create file &amp;lt;code&amp;gt;/etc/pm/config.d/config&amp;lt;/code&amp;gt; and put there one line &amp;lt;code&amp;gt;DISPLAY_QUIRK_S3_BIOS=&amp;quot;true&amp;quot;&amp;lt;/code&amp;gt;, or execute following command:&lt;br /&gt;
&lt;br /&gt;
 echo DISPLAY_QUIRK_S3_BIOS=\&amp;quot;true\&amp;quot; &amp;gt;&amp;gt; /etc/pm/config.d/config&lt;br /&gt;
&lt;br /&gt;
===Semi-Solution for ThinkPad X60 with damaged system after s2ram usage===&lt;br /&gt;
It happend when restarting a s2ram-session.&lt;br /&gt;
&lt;br /&gt;
'''Symptom:''' Black screen with blinking &amp;quot;_&amp;quot; sign remaind. (without the &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
'''System status:''' HDD idle, fan running, everything else looks to wait for something to happen.&lt;br /&gt;
&lt;br /&gt;
'''Semi-Solution:''' Booting with DVD-ROM and going through the installations menu,&lt;br /&gt;
where you choose &amp;quot;other&amp;quot; and &amp;quot;boot a installed system&amp;quot; (something like that). Gladly it works,&lt;br /&gt;
and OpenSuSE 10.1 comes up with 50% &amp;quot;failed&amp;quot; messages! I than shutdown properly, rebooted again&lt;br /&gt;
and had 100% &amp;quot;done&amp;quot; again, with no other things affected.&lt;br /&gt;
&lt;br /&gt;
'''Further:''' Repairing with the DVD-ROM crashed massivly(!), so I selected &amp;quot;boot a installed system&amp;quot; as final&lt;br /&gt;
solution and it worked!&lt;br /&gt;
&lt;br /&gt;
'''Unknown:''' Maybe the Solution for ThinkPads with 1400x1050 internal LCD and Intel 915GM will help,&lt;br /&gt;
because X60s and X60 are very familiar. (Not tested so far.)&lt;br /&gt;
&lt;br /&gt;
(If this Problem is not right here, please edit and move.)&lt;br /&gt;
&lt;br /&gt;
===Solution for ThinkPads with 1400x1050 internal LCD and Intel 915GM ===&lt;br /&gt;
see [[1400x1050 on Intel 915GM]].&lt;br /&gt;
===Solution for ThinkPads with ATI graphic chips and Intel 915/945GM ===&lt;br /&gt;
&lt;br /&gt;
Affected models include {{X60s}}, {{X200s}}, {{R60}} and {{T60}}.&lt;br /&gt;
&lt;br /&gt;
This soluton also applies to T42 with Intel 855 and ATI 9600 M10.&lt;br /&gt;
&lt;br /&gt;
One solution may be to provide the {{bootparm|acpi_sleep|s3_bios}} kernel parameter in your kernel parameter line.&lt;br /&gt;
&lt;br /&gt;
For grub this would look like this:&lt;br /&gt;
&lt;br /&gt;
 title           Linux, kernel 2.6.11-1-686&lt;br /&gt;
 root            (hd0,0)&lt;br /&gt;
 kernel          /boot/vmlinuz-2.6.11-1-686 root=/dev/hda1 ro acpi_sleep=s3_bios&lt;br /&gt;
 initrd          /boot/initrd.img-2.6.11-1-686&lt;br /&gt;
 savedefault&lt;br /&gt;
 boot&lt;br /&gt;
&lt;br /&gt;
For lilo it would look like this:&lt;br /&gt;
&lt;br /&gt;
 image=/boot/vmlinuz&lt;br /&gt;
     append=&amp;quot;acpi_sleep=s3_bios&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The actual process of going to sleep is then managed through a sleep script; as a start, see the {{path|sleep.sh}} script in the Extreme Graphics 2 section below, but note the following comments:&lt;br /&gt;
&lt;br /&gt;
In [[:Category:OpenSUSE|OpenSUSE]] 10.1 (at least on a T43p), it's necessary to override the default options for s2ram if you're using the newer ATI driver.  This can be done putting {{bootparm|SUSPEND2RAM_FORCE|&amp;quot;yes&amp;quot;}} and {{bootparm|SUSPEND2RAM_ACPI_SLEEP|&amp;quot;3&amp;quot;}} in {{path|/etc/powersave/sleep}}.&lt;br /&gt;
&lt;br /&gt;
In {{Ubuntu}} or {{Kubuntu}}, it may be necessary to modify {{path|/etc/default/acpi-support}}.  In that file, make sure that {{path|ACPI_SLEEP}} is uncommented and set to true.  With ATI chips, also make sure that {{path|SAVE_VBE_STATE}} is uncommented and set to true; with Intel chips, on the other hand, ensure that nothing is done with respect to VBE--no reposts, no state saves. Also commenting POST_VIDEO may help. &lt;br /&gt;
&lt;br /&gt;
In {{Fedora}}, it may be necessary with the Intel chips to edit the {{path|resume_video()}} function in {{path|/etc/pm/functions-intel}} to comment out the VBE post and restore.  (As of FC6 these seem to be pre-commented out.)  Also, the laptop, after waking up, may go back to sleep immediately or whenever the AC adapter is disconnected.  When this happens, it's caused by a bug in the HAL daemon that incorrectly reports certain ACPI events.  This is a known problem and a simple workaround is described [http://live.gnome.org/GnomePowerManager/Faq#head-b8b1280115b0a51c2cc27b13a57121130ebf36cb here].&lt;br /&gt;
&lt;br /&gt;
{{NOTE|It is possible this method will not work if the laptop is docked.  It is also possible that the cited workaround for the HAL daemon bug will not work on some machines.  A kludgier workaround in this event is to kill the HAL daemon on suspend.  This necessitates the resuscitation of GPM upon resume.}}&lt;br /&gt;
&lt;br /&gt;
Another solution is to use vbetool. If you are using {{Debian}} with the hibernate package, uncomment &amp;quot;EnableVbetool yes&amp;quot; in {{path|/etc/hibernate/hibernate.conf}} (or {{path|/etc/hibernate/ram.conf}}).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
On '''T60 2007-CTO''' (Core2Duo 2Ghz, 2GB Ram, ATI X1400) the screen stayed blank after suspend-to-ram until I set '''vga=0''' in lilo.conf.&lt;br /&gt;
&lt;br /&gt;
Working config:&lt;br /&gt;
 Linux 2.6.21.5&lt;br /&gt;
 fglrx 8.37.6&lt;br /&gt;
 debian etch:&lt;br /&gt;
  powersaved 0.14.0-5:&lt;br /&gt;
   UNLOAD_MODULES_BEFORE_SUSPEND2DISK=&amp;quot;usb_storage ohci_hcd uhci_hcd ehci_hcd ipw3945 pcmcia yenta_socket rsrc_nonstatic pcmcia_core&amp;quot;&lt;br /&gt;
   UNLOAD_MODULES_BEFORE_SUSPEND2RAM=&amp;quot;usb_storage ohci_hcd uhci_hcd ehci_hcd ipw3945 pcmcia yenta_socket rsrc_nonstatic pcmcia_core&amp;quot;   &lt;br /&gt;
  hibernate:&lt;br /&gt;
   SwitchToTextMode yes&lt;br /&gt;
  lilo.conf:&lt;br /&gt;
   vga=0&lt;br /&gt;
&lt;br /&gt;
&amp;quot;EnableVbetool yes&amp;quot; and other suggestions didn't work for me.&lt;br /&gt;
&lt;br /&gt;
For suspend-to-disk, don't load fglrx in initrd.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
On '''T60-20076RG''' (Core2Duo 2GHz, ATI X1400) with {{OpenSUSE}} 11.1 and fglrx 8-12 the following had to be done to get suspend to RAM always resume:&lt;br /&gt;
* Add {{bootparm|S2RAM_QUIRKS_SOURCE|&amp;quot;s2ram&amp;quot;}} to file {{path|/etc/pm/config.d/config}}&lt;br /&gt;
* Create an executable script {{path|/etc/pm/sleep.d/00text}} containing:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
         hibernate|suspend)&lt;br /&gt;
                 /bin/chvt 1&lt;br /&gt;
                 ;;&lt;br /&gt;
         thaw|resume)&lt;br /&gt;
                 /bin/chvt 7&lt;br /&gt;
                 ;;&lt;br /&gt;
 esac&lt;br /&gt;
&lt;br /&gt;
There seems to be a bug ([https://bugzilla.novell.com/show_bug.cgi?id=463434 Novell bugzilla]) which makes it impossible for s2ram to switch to text console while suspending through pm-suspend. The script above forces console change. Along with setting s2ram as quirks source (which makes it correctly set acpi_bios before suspend - to s3_bios,s3_mode&lt;br /&gt;
for T60 2007*) this can make resume work flawlessly despite using vesafb.&lt;br /&gt;
&lt;br /&gt;
===Solution for ThinkPads with Intel Extreme Graphics 2===&lt;br /&gt;
{{NOTE|&lt;br /&gt;
On [[:Category:X40|X40]]s/[[:Category:X41|X41]]s - even with Intel Extreme Graphics - and for [[:Category:R52|R52]]s with Intel Graphics Media Accelerator 900 the [[Problem with display remaining black after resume#Solution for ThinkPads with ATI graphic chips|solution for ATI graphics chips]] above is reported to work. In this case, make sure no changes to VBE are made, especially no state saves and no reposts.}}&lt;br /&gt;
&lt;br /&gt;
The following solution should work on 865G, 865GV, 855GM, 855GME, 852GME chipsets.&lt;br /&gt;
*First of all, '''do not''' use the {{bootparm|acpi_sleep|s3_bios}} kernel parameter.&lt;br /&gt;
*Second, completely remove framebuffer support from your kernel. If it's built as modules, it is important that they do not get loaded at all.&lt;br /&gt;
*Before suspending, change to a console and safe the video state with {{cmdroot|cat /proc/bus/pci/00/02.0 &amp;gt; /tmp/video_state}}.&lt;br /&gt;
*On resume, restore the video state with {{cmdroot|cat /tmp/video_state &amp;gt; /proc/bus/pci/00/02.0}} and change back to X.&lt;br /&gt;
*For Debian Etch 4.0 on R50e just make following changes to /etc/default/acpi-support:&lt;br /&gt;
 #SAVE_VBE_STATE=true&lt;br /&gt;
 #VBESTATE=/var/lib/acpi-support/vbestate&lt;br /&gt;
 #POST_VIDEO=true&lt;br /&gt;
 SAVE_VIDEO_PCI_STATE=true&lt;br /&gt;
&lt;br /&gt;
*For a R50e the only thing needed to make suspend to ram work in Ubuntu 6.06 is adding&lt;br /&gt;
 Option  &amp;quot;VBERestore&amp;quot; &amp;quot;yes&amp;quot;&lt;br /&gt;
to the &amp;lt;tt&amp;gt;Device&amp;lt;/tt&amp;gt; section in your {{path|/etc/X11/xorg.conf}}, and the example script below.&lt;br /&gt;
&lt;br /&gt;
The following example {{path|/etc/acpi/actions/sleep.sh}} script shows how to integrate the according lines.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 # change to console 1&lt;br /&gt;
 FGCONSOLE=`fgconsole`&lt;br /&gt;
 chvt 6&lt;br /&gt;
 &lt;br /&gt;
 # safe video state&lt;br /&gt;
 cat /proc/bus/pci/00/02.0 &amp;gt; /tmp/video_state&lt;br /&gt;
 &lt;br /&gt;
 # sync filesystem&lt;br /&gt;
 sync&lt;br /&gt;
 &lt;br /&gt;
 # sync hardware clock with system time&lt;br /&gt;
 hwclock --systohc&lt;br /&gt;
 &lt;br /&gt;
 # go to sleep&lt;br /&gt;
 echo -n 3 &amp;gt; /proc/acpi/sleep&lt;br /&gt;
 &lt;br /&gt;
 # waking up&lt;br /&gt;
 # restore system clock&lt;br /&gt;
 hwclock --hctosys&lt;br /&gt;
 &lt;br /&gt;
 # restore video state&lt;br /&gt;
 cat /tmp/video_state &amp;gt; /proc/bus/pci/00/02.0&lt;br /&gt;
 &lt;br /&gt;
 # change back to X&lt;br /&gt;
 chvt $FGCONSOLE&lt;br /&gt;
 &lt;br /&gt;
 # clean up behind us&lt;br /&gt;
 rm /tmp/video_state&lt;br /&gt;
&lt;br /&gt;
With Ubuntu 6.10 on a [[:Category:R51|R51 (2887-32G)]] I ''just'' (as none of the other tricks above) had to add {{bootparm|fb|false}} to the kernel line in {{path|/etc/grub/menu.lst}} and edit {{path|/etc/defaults/acpi-support}} this way:&lt;br /&gt;
&lt;br /&gt;
 SAVE_VBE_STATE=false&lt;br /&gt;
 POST_VIDEO=false&lt;br /&gt;
 SAVE_VIDEO_PCI_STATE=true&lt;br /&gt;
 USE_DPMS=false&lt;br /&gt;
 DOUBLE_CONSOLE_SWITCH=false&lt;br /&gt;
&lt;br /&gt;
===Solution for ThinkPads with Intel I830 Chipset===&lt;br /&gt;
The following solution worked for me on an X30 with I830M chipset with kernel &amp;gt;= 2.6.16.&lt;br /&gt;
*this works with vesafb and also with intelfb frambuffer support.&lt;br /&gt;
The following example {{path|/etc/acpi/actions/sleep.sh}} script shows how to integrate the according lines.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 FGCONSOLE=`fgconsole`&lt;br /&gt;
 chvt 8&lt;br /&gt;
 sync&lt;br /&gt;
 hwclock --systohc&lt;br /&gt;
 &lt;br /&gt;
 echo -n &amp;quot;mem&amp;quot; &amp;gt; /sys/power/state&lt;br /&gt;
 &lt;br /&gt;
 hwclock --hctosys&lt;br /&gt;
 vbetool post&lt;br /&gt;
 &lt;br /&gt;
 if [ &amp;quot;$FGCONSOLE&amp;quot; -ge &amp;quot;7&amp;quot; ] ; then&lt;br /&gt;
   chvt $FGCONSOLE&lt;br /&gt;
 else&lt;br /&gt;
   chvt 7&lt;br /&gt;
   chvt $FGCONSOLE&lt;br /&gt;
 fi&lt;br /&gt;
===Solution for ThinkPads with ATI graphic (and possibly other) chips and FreeBSD===&lt;br /&gt;
&lt;br /&gt;
The FreeBSD acpi(4) manpage mentions a tunable parameter, &amp;quot;hw.acpi.reset_video&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    hw.acpi.reset_video&lt;br /&gt;
             Reset the video adapter from real mode during the resume path.&lt;br /&gt;
             Some systems need this help, others have display problems if it&lt;br /&gt;
             is enabled.  Default is 0 (disabled).&lt;br /&gt;
&lt;br /&gt;
This tunable can be set by adding the following line to your FreeBSD machine's /boot/loader.conf file:&lt;br /&gt;
&lt;br /&gt;
    hw.acpi.reset_video=&amp;quot;1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And rebooting your machine.  Hopefully, the next time you resume from a suspend, you'll see your video again.  This solution doesn't appear to be specific to ATI hardware in any way, so I presume it would be helpful for video chipsets other than ATI, as well.&lt;br /&gt;
&lt;br /&gt;
If this entry doesn't help you, you might consider searching in the [http://lists.freebsd.org/pipermail/freebsd-mobile/ FreeBSD-Mobile email-list archive] for more insight.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{footnotes|&lt;br /&gt;
#If you have this problem with R50e and the above solution doesn't work, try switching to console first. An example sleep script can be found [[How to configure acpid|here]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Solution using s2ram for Intel 915/945GM===&lt;br /&gt;
&lt;br /&gt;
Just using the &amp;quot;s2ram -f -p&amp;quot; command from the uswsusp package will work from within X, at least on a {{Z61e}}. On {{X60s}} it is enough to issue the &amp;quot;s2ram&amp;quot; command and it works. On {{X61}} &amp;quot;s2ram -f -a 1&amp;quot; can work properly. Best idea seems to be to put this into the corresponding acpi script:&lt;br /&gt;
&lt;br /&gt;
 % cat /etc/acpi/sleep.sh &lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 test -f /usr/share/acpi-support/power-funcs || exit 0&lt;br /&gt;
 test -f /usr/sbin/s2ram || exit 0&lt;br /&gt;
 rmmod usb_storage&lt;br /&gt;
 rmmod uhci_hcd&lt;br /&gt;
 rmmod ehci_hcd&lt;br /&gt;
 /usr/sbin/s2ram -f -a 1 -m&lt;br /&gt;
 modprobe uhci_hcd&lt;br /&gt;
 modprobe ehci_hcd&lt;br /&gt;
 modprobe usb_storage&lt;br /&gt;
&lt;br /&gt;
Source: [http://d.hatena.ne.jp/conceal-rs/20080309/1205083315 http://d.hatena.ne.jp/conceal-rs/20080309/1205083315]&lt;br /&gt;
Works on my X61.&lt;br /&gt;
&lt;br /&gt;
===Solution using DOUBLE_CONSOLE_SWITCH===&lt;br /&gt;
&lt;br /&gt;
By setting the following in {{path|/etc/default/acpi-support}} the display comes back on {{X61s}} using Intel chipset:&lt;br /&gt;
&lt;br /&gt;
     DOUBLE_CONSOLE_SWITCH=true&lt;br /&gt;
&lt;br /&gt;
Fedora 8 doesn't have DOUBLE_CONSOLE_SWITCH, but it works when one does:  First, add option &amp;quot;VBERestore&amp;quot; &amp;quot;true&amp;quot; to /etc/X11/xorg.conf&lt;br /&gt;
&lt;br /&gt;
    Section &amp;quot;Device&amp;quot;&lt;br /&gt;
        Identifier  &amp;quot;Videocard0&amp;quot;&lt;br /&gt;
        Driver      &amp;quot;intel&amp;quot;&lt;br /&gt;
        Option      &amp;quot;VBERestore&amp;quot;  &amp;quot;true&amp;quot; &lt;br /&gt;
    EndSection&lt;br /&gt;
&lt;br /&gt;
Then suspends with&lt;br /&gt;
&lt;br /&gt;
    pm-suspend --quirk-vbemode-restore --quirk-s3-bios&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=40503</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=40503"/>
		<updated>2009-01-08T23:16:53Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://sourceforge.net/project/platformdownload.php?group_id=249872&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=40502</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=40502"/>
		<updated>2009-01-08T23:14:45Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.&lt;br /&gt;
&lt;br /&gt;
* Download here: https://sourceforge.net/project/platformdownload.php?group_id=249872&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=40500</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=40500"/>
		<updated>2009-01-08T23:12:36Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://phuk.ath.cx:3080/thinkfan/&lt;br /&gt;
(sorry, server is currently down...)&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
For those using Ubuntu 8.10 and recent Thinkpad models (eg: X200), this is the fan control packages to use: sudo apt-get install tpfand tpfan-admin tpfand-profiles (The packages are part of the main ubuntu repository). It solves the problem of a constantly-on fan. I don't think there are yet profiles for those newer thinkpad models, but it's fairly easy to manually configure the right thresholds. For reference, this is the /etc/tpfand.conf I use for my X200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
enabled = True&lt;br /&gt;
&lt;br /&gt;
override_profile = True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
0. Sensor 0 = 0:0 50:3 58:5 67:8&lt;br /&gt;
&lt;br /&gt;
1. Sensor 1 = 0:0 55:3 62:5 69:8&lt;br /&gt;
&lt;br /&gt;
2. Sensor 2 = 0:255&lt;br /&gt;
&lt;br /&gt;
3. Sensor 3 = 0:0 48:3 61:5 69:8&lt;br /&gt;
&lt;br /&gt;
4. Sensor 4 = 0:0 43:3 50:8&lt;br /&gt;
&lt;br /&gt;
5. Sensor 5 = 0:255&lt;br /&gt;
&lt;br /&gt;
6. Sensor 6 = 0:0 40:8&lt;br /&gt;
&lt;br /&gt;
7. Sensor 7 = 0:255&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38502</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38502"/>
		<updated>2008-08-07T16:11:29Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. It simply averages the two highest temperatures found in /proc/acpi/ibm/thermal. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://phuk.ath.cx:3080/thinkfan/&lt;br /&gt;
(sorry about the dyndns crap)&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38312</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38312"/>
		<updated>2008-07-27T03:03:56Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. It simply averages the two highest temperatures found in /proc/acpi/ibm/thermal. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1.&lt;br /&gt;
&lt;br /&gt;
* Download here: http://phuk.ath.cx:3080/thinkfan/&lt;br /&gt;
(sorry about the dyndns crap)&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38311</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38311"/>
		<updated>2008-07-27T02:58:03Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. It simply averages the two highest temperatures found in /proc/acpi/ibm/thermal. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1.&lt;br /&gt;
&lt;br /&gt;
* Download link: http://phuk.ath.cx:3080/thinkfan/thinkfan-current.tar.bz2&lt;br /&gt;
(sorry about the dyndns crap)&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38297</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38297"/>
		<updated>2008-07-25T21:39:33Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* thinkfan: A minimalist fan control program */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Written in C to use as little CPU power as possible. It simply averages the two highest temperatures found in /proc/acpi/ibm/thermal. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1.&lt;br /&gt;
&lt;br /&gt;
* Download link: http://phuk.ath.cx:3080/thinkfan/thinkfan-0.2.tar.bz2&lt;br /&gt;
(sorry about the dyndns crap)&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38296</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=38296"/>
		<updated>2008-07-25T21:38:48Z</updated>

		<summary type="html">&lt;p&gt;Vm: /* Variable speed control scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page provides several scripts for controlling the ThinkPad's system fan according the its [[thermal sensors]] (overriding the embedded controller), in order to reduce [[problem with fan noise|fan noise]] and decrease [[how to reduce power consumption|power consumption]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures!}}&lt;br /&gt;
{{NOTE|Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation.  The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Variable speed control scripts==&lt;br /&gt;
The following scripts sets the fan speed according to the system's [[thermal sensors]]. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.&lt;br /&gt;
&lt;br /&gt;
===Comprehensive &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed===&lt;br /&gt;
This script works with any recent Linux kernel (2.6.14 and higher). It requires the [[ibm-acpi]] module to be loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; module parameter (e.g., {{cmdroot|1=modprobe ibm_acpi experimental=1}}).&lt;br /&gt;
&lt;br /&gt;
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., {{cmdroot|1=modprobe thinkpad-acpi experimental=1 fan_control=1}})&lt;br /&gt;
&lt;br /&gt;
The code lets you define a temperature range for each [[thermal sensors|thermal sensor]]. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the [[Problem with fan noise|pulsing noise]] problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented [[How to control fan speed|here]]. &lt;br /&gt;
&lt;br /&gt;
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel &amp;gt;= 2.6.19-rc1 or the ide driver, since it uses a [[Thermal Sensors#Hitachi_harddisks_SENSE_CONDITION_temperature_sensor|non-standard method]] for reading the temperature without causing a head unload or spinup.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
* {{CodeRef|tp-fancontrol}}&lt;br /&gt;
&lt;br /&gt;
Current options:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./tp-fancontrol [OPTION]...&lt;br /&gt;
 &lt;br /&gt;
 Available options:&lt;br /&gt;
   -s N   Shift up the min temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler).&lt;br /&gt;
          Max temperature thresholds are not affected.&lt;br /&gt;
   -S N   Shift up the max temperature thresholds by N degrees&lt;br /&gt;
          (positive for quieter, negative for cooler). DANGEROUS.&lt;br /&gt;
   -t     Test mode&lt;br /&gt;
   -q     Quiet mode&lt;br /&gt;
   -d     Daemon mode, go into background (implies -q)&lt;br /&gt;
   -l     Log to syslog&lt;br /&gt;
   -k     Kill already-running daemon&lt;br /&gt;
   -u     Tell already-running daemon that the system is being suspended&lt;br /&gt;
   -p     Pid file location for daemon mode&lt;br /&gt;
{{WARN|The list of temperature ranges used in this script is much more liberal than the rules used by the embedded controller firmware, and is derived mostly from anecdotal evidence, hunches and wishful thinking. It is also model-specific - see [[thermal sensors]].}}&lt;br /&gt;
&lt;br /&gt;
====init script for the comprehensive script====&lt;br /&gt;
&lt;br /&gt;
This is optional. It assumes that the above &amp;lt;tt&amp;gt;tp-fancontrol&amp;lt;/tt&amp;gt; script is saved at {{path|/usr/bin/tp-fancontrol}}.&lt;br /&gt;
* Init script: {{CodeRef|tp-fancontrol.init}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Init script (Debian): {{CodeRef|tp-fancontrol.init.debian}} (save as {{path|/etc/init.d/tp-fancontrol}})&lt;br /&gt;
* Configuration file for init script: {{CodeRef|tp-fancontrol.conf}} (save as {{path|/etc/tp-fancontrol.conf}})&lt;br /&gt;
&lt;br /&gt;
===Simple &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; script with fine control over fan speed (requires kernel patch)===&lt;br /&gt;
The following is a simpler patch (without extra features like daemon mode and logging). It requires the [[patch for controlling fan speed]] or a recent kernel (&amp;gt;=2.6.19).&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-basic}}&lt;br /&gt;
&lt;br /&gt;
===tp-fan: Automatic daemon with GTK+ GUI===&lt;br /&gt;
Provides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.&lt;br /&gt;
&lt;br /&gt;
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.&lt;br /&gt;
&lt;br /&gt;
* Home page: http://www.gambitchess.org/moin.py/tpfan&lt;br /&gt;
&lt;br /&gt;
===thinkfan: A minimalist fan control program===&lt;br /&gt;
Designed to use as little CPU power as possible. It simply averages the two highest temperatures found in /proc/acpi/ibm/thermal. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1.&lt;br /&gt;
&lt;br /&gt;
* Download link: http://phuk.ath.cx:3080/thinkfan/thinkfan-0.2.tar.bz2&lt;br /&gt;
(sorry about the dyndns crap)&lt;br /&gt;
&lt;br /&gt;
==Fan enable/disable scripts==&lt;br /&gt;
The following scripts were written before it was known [[patch for controlling fan speed|how to control the fan speed]], so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available [[thermal sensors]].&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script example===&lt;br /&gt;
{{CodeRef|fan-enable-basic}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with more features===&lt;br /&gt;
{{CodeRef|fan-enable-extended}}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;tt&amp;gt;sh&amp;lt;/tt&amp;gt; script with extra safety functionality===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches various signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable-safe}}&lt;br /&gt;
&lt;br /&gt;
==Init scripts==&lt;br /&gt;
&lt;br /&gt;
===Init script example===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|fan-enable.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for gentoo===&lt;br /&gt;
Assume one of the above control scripts is {{path|/usr/sbin/ibm-fancontrold}}, for gentoo use the following init script in /etc/init.d/ibm-fancontrol.&lt;br /&gt;
Copy the script to {{path|/etc/init.d/ibm-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # rc-update add ibm-fancontrol default&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|ibm-fancontrol.init}}&lt;br /&gt;
&lt;br /&gt;
===Init script example for rh/fedora===&lt;br /&gt;
Assume one of the above control scripts is {{path|/sbin/tp-fancontrold}},&lt;br /&gt;
copy the script to {{path|/etc/init.d/tp-fancontrol}}, then do &lt;br /&gt;
&lt;br /&gt;
 # chkconfig --add tp-fancontrol&lt;br /&gt;
&lt;br /&gt;
This will add the init script to the default runlevel.&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-fancontrol-fc.init}}&lt;br /&gt;
&lt;br /&gt;
You'd have to install also &amp;quot;kernel-module-ibm-acpi&amp;quot; package.&lt;br /&gt;
&lt;br /&gt;
==Other==&lt;br /&gt;
&lt;br /&gt;
===fanctrld===&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
===ThinkPad Fan Control GTK GUI tool===&lt;br /&gt;
&lt;br /&gt;
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10)] may also help.&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Use the [[HDAPS]] sensor to automatically lower the temperature thresholds when the laptop is moving. Prolonged movement usually happens when the laptop is on the user's lap (see [[Problem with hot surfaces]] for implications), or when in a moving vehicle where fan noise is typically overshadowed by vehicle noise.&lt;br /&gt;
* Use a [http://en.wikipedia.org/wiki/PID_controller PID controller] feedback loop instead of simple thresholds.&lt;br /&gt;
* Monitor the UltraBay disk temperature too.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to control fan speed]]&lt;br /&gt;
* Shimodax's ThinkPad fan control tool for a Windows offers functionality similar to these scripts; see the [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com.&lt;br /&gt;
* Yury Polyanskiy has a [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2005-November/030697.html kernel patch] for automatic fan control in kernelspace (only enable/disable based on maximum temperature).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Vm</name></author>
		
	</entry>
</feed>