Talk:Fan control scripts
Wyrfel, are you sure the recent (19:54, 27 Oct 2005) cosmetic change was a good idea? The extensive chunks of code make it hard to grok the structure of the article in the absense of separator lines (which "===" doesn't have). --Thinker 22:10, 27 Oct 2005 (CEST)
We can discuss this. From my point of view, the chunks of code distinguish themselves from each other quite well, because they are each in one code block.
I do not like the = section level - and so far we avoided them on all pages - because
- it generates H1 headings, which is the same as the page heading,
- having more than one level with the hbars is confusing/less readable, because they are not very well distinguishable. This way i.e. the "Other" section looked like a separate empty secion.
I think the way it's now, the separator lines make it possible to easily distinguish the different main sections, while when you have both levels with separator lines, an additional task of distinguishing H1 and H2 separators is necessary.
However, i see your point as well and would like to hear more opinions/arguments.
Wyrfel 22:31, 27 Oct 2005 (CEST)
Contents
- 1 bash script with fine control over fan speed (for unpatched kernels)
- 2 Sensor-specific variable-speed script
- 3 Fan enable/disable scripts
- 4 working on a thinkpad X20?
- 5 Question on temperatures
- 6 Comprehensive script - OFF_THRESH_DELTA doesn't work
- 7 t60-fancontrold script
- 8 cat: /sys/block/hda/device/model: No such file or directory
- 9 same problem with cat: /sys/block...
- 10 Script errors out
- 11 T60 temperature thresholds?
- 12 Am I doing something wrong?
- 13 Update t60-fancontrold
- 14 Limiting/lowering CPU clock during temperature emergency
- 15 fan pulsing noise on X31 despite tp-fancontrol
bash script with fine control over fan speed (for unpatched kernels)
Moved to the article page, after joint development by Spiney and Thinker.
Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.
I think it'd probably be nice to have a table of the suggested values here. Those in the "unpatched kernels" script seems to work fine on my R52, but the other scripts all have different values.
--Micampe 08:19, 12 Nov 2005 (CET)
Sensor-specific variable-speed script
Here's a new variable-speed control script that lets you define the temperature range separately for each sensor. To keep things simple, it auto-computes the trip points (unlike the current script). Works well on a T43, and (just barely) keeps the fan off most of the time with CPU undervolting and fglrx set to maximum power saving. Feedback on other machines would be appreciated.
Any idea what are the sensors at EC offsets 0x79, 0x7A, 0xC0, 0xC1, 0xC2? On the T43, 0x79 seems to be the same as the HDAPS sensor (it never deviates by more than one degree from what the HDAPS sensor tells directly), but I don't know where it's located. Sensor 0x7A is uncorrelated with disk temperature and activity, so it can't be HDD like reported ofor R52. Sensor 0xC1 seems to be under the palm-rest (see discussion in Talk:Problem_with_fan_noise).
This version also lets the EC read the RPM sensor every few minutes even when the anti-pulsing hack (which normally prevents this) is in use.
Script moved to the article page.
Feedback very much welcome.
--Thinker 23:08, 27 Nov 2005 (CET)
- I use the script on my T41 and it works great, it doesn't crash like the windows fancontrol (check sourceforge).
- Some remarks: I removed the anti pulsing section because it didn't do anything useful on my laptop. I also raised some temperatures and removed the speed '1', because it barely cools my laptop and makes only slightly less noise than speed '3', which now replaces speed '1'. SirB 18:55, 20 July 2006 (CEST)
Fan enable/disable scripts
We currently have two types of scripts -- the old ones which only enable/disable the fan, and the new ones which control the fan speed. Do the latter supercede the former, or do we know of models on which only enable/disable works? Maybe eventually the enable/disable scripts should be "archived" in the talk page to reduce clutter in the article?
--Thinker 00:08, 28 Nov 2005 (CET)
Things seem pretty stable for the variable-speed script and the list of working models looks good. Since it is superior to the enable/disable scripts in regard to both the annoyance and the impact on hardware, I'll change the organization of the page to put that script first (unless someone objects)..
--Thinker 16:07, 7 Dec 2005 (CET)
I don't see the point in having the enable/disable scripts when the variable speed one works fine. I'd vote for moving the old scripts here and only keep the better ones in the article, unless somebody has a sane use case for which those are bettere than the new scripts.
--Micampe 16:19, 7 Dec 2005 (CET)
working on a thinkpad X20?
hello! my /proc/acpi/ibm directory looks like this:
m@homebase:/proc/acpi/ibm$ ls bay bluetooth dock driver hotkey light video
so the scripts don´t work, because i do not hat a /proc/acpi/ibm/thermal or a /proc/acpi/ibm/fan directory! do you have any ideas whats wrong?
--Manfreeed
What version of ibm_acpi are you using ("cat /proc/acpi/ibm/driver")? Did you load it with the "experimental=1" module parameter?
--Thinker 19:30, 26 Dec 2005 (CET)
- hallo agian, i use IBM ThinkPad ACPI Extras version:0.8 on a Ubuntu Linux with kernel: 2.6.12-10-386. i didn´t change any module parameter. how can i do this? thanks for your help! --Manfreeed 22:14, 27 Dec 2005 (CET)
You need a newer kernel 2.6.14 or newer, or to manually install ibm_api 0.12. It's all explained in ibm-acpi.
--Thinker 06:43, 28 Dec 2005 (CET)
There is no 0.12 available as a separate download, it is only included in 2.6.14. But 0.11 from the website works just fine for me with the stock Ubuntu kernel.
--Micampe 11:11, 28 Dec 2005 (CET)
Question on temperatures
I've been testing the 'script with fine control over fan speed' on my r50e, kernel 2.6.15, which still contains version 0.12a of the ibm_acpi module. The script works fine but I notice two things:
1. The seven speed levels don't seem to correspond with seven actual speeds but rather with only three. I also notice that only 3 levels, 2, 4 and 7 are actually used in the script.
2. The given range of temperatures - 52, 60, 68 - causes the fan in my Thinkpad to run even more often than under embedded control, so I would naturally like to raise them. As the maximum core temperature is 100°C, I wonder why I shouldn't use, say 72, 80, 88 instead. - How (im)precise are the temperature data in /proc/acpi/ibm/thermal?
antonix
1. On all models I'm aware of, some of the levels are equivelent. So the script only bothers with the different ones. You can test your model manually using How to control fan speed.
2. Yes, in the script you used (the "simple" one), the threshold for highest fan speed is set fairly low, because the same threshold is used for all components and some are more sensitive than others. The "comprehensive" script, also on the article page, lets you control each component separately, so you can raise the threshold for the CPU and GPU without risking burning something else. But note that the thresholds listed there were chosen for a T43, which probably has different thermal sensors than your R50e.
--Thinker 10:00, 14 March 2006 (CET)
Comprehensive script - OFF_THRESH_DELTA doesn't work
No matter to what value I set the OFF_THRESH_DELTA, fan always turns off at 10 degrees below min temperature. Is there any way to make it work properly? I have a R50e with Gentoo Linux, kernel 2.6.17. Regards Caleb9
Please run the unmodified tp-fancontrol in non-daemon non-quiet mode (so you'll see all the verbose status reports), and post examples of the status lines when it does the wrong thing. --Thinker 15:50, 21 October 2006 (CEST)
t60-fancontrold script
Hi all,
since I wasn't entirely satisfied with how tp-fancontrol worked on my T60, I decided to write an alternative script derived from t60-fancontrol (but differing in some respects). It is meant to run as a daemon by default and the main changes are
- different fan level stepping/calculation algorithm
- no perl dependency
- proper config file parsing
- changed/differently behaving command line options
- support for docked and undocked status (different thermal ranges)
- more standard init.d start script
- different temperature values (optimized for my T60)
Get it at
http://www.hobbes.gmxhome.de/t60-fancontrold/0.1.4.1/t60-fancontrold-0.1.4.1.tar.gz (source)
and
http://www.hobbes.gmxhome.de/t60-fancontrold/0.1.4.1/t60-fancontrold-0.1.4.1-1.noarch.rpm (built for SuSE Linux 10.1)
I developed it on SuSE Linux 10.1 and tested it on my T60 (2007-FSG, Core Duo T2400, ATI X1400 128 MB). Since I don't have any experience with other ThinkPad's, I can only recommend it for the T60 series, but it might work just as well on other models (with adapted temperature ranges). It works fine for me, but I surely didn't catch all bugs.
Although I must emphasize that the script comes without any warranty (see also README), I'd be happy if you'd test it and give me feedback. Please read the README for general and installation information.
Best regards, Nick.
Can you summarize the difference in the algorithm, and its motivation?
--Thinker 23:59, 2 December 2006 (CET)
The stepping down from a certain level when all sensor temperatures were long below the respective thresholds didn't seems to work for me. I played around with the temperature ranges and other control parameters, but that didn't help much.
When I looked into the tp-fancontrol routines, the coding in the script appeared - please, no offense - a bit dense ;-) Apart from that, a proper config file with respective parsing in the script was missing. Also I didn't see the necessity of using perl.
Besides the fact that I enjoyed the bit of coding, the fan is now controlled better on my T60. My post was just to let you know about t60-fancontrold and not meant offensive in any way.
To better see what I've done I recommend that you look at the code itself, which presumably tells you a lot more than I can illustrate in my posting.
All the best
--nick 00:25, 3 December 2006 (CET)
No offence taken, I'm just curious since it worked great for me. About lowering levels, there are two (intentional) hysteresis effects involved: first, the temperature at which it steps down is lower than the temperature at which it steps up. Second, once it entered a given level, it will not step down before $MIN_WAIT seconds have passed. Both are important so I hope your script does them too (in which case, I guess its code is just as dense...).
--Thinker 00:47, 3 December 2006 (CET)
My script has something like the MIN_WAIT time loop, but it's implemented in a different way: the passed time is not measured absolutely in seconds and then checked against the current time, but in terms of how many INTERVAL cycles where all sensor temperatures are below the threshold-DELTA_T limit have since passed. The respective parameter in my script is called MIN_WAIT_INTERVALS.
Besides the temperature/stepping algorithm, t60-fancontrold has a more standardized init.d start script (for SuSE 10.1, which is a good choice for the T60) and all options can be set in the config file now, which is actually parsed, not just sourced by tp-fancontrol.init. Also I found that I needed different temperature levels when working docked or undocked.
But all other ThinkPad users seem to be getting along with tp-fancontrol quite well, so I guess the fun when writing t60-fancontrold was another factor ;-)
Thank you very much for your comments, if you have more, please let me known them!
Regards,
--nick 09:52, 3 December 2006 (CET)
Would anybody object if I added an entry for t60-fancontrold under "Other" on the "ACPI fan control script" article page? Did somebody try t60-fancontrold or are there any comments on the code?
Best,
--nick 12:04, 5 December 2006 (CET)
Sure, go ahead. You can give it an informative subsection of its own.
--Thinker 21:03, 5 December 2006 (CET)
Nick, I'd be interested in knowing the temperature ranges you have defined for your T60. Unfortunately, your scripts aren't available (anymore) at the links you have provided.
--Gunnar 23:35, 9 January 2007 (CET)
cat: /sys/block/hda/device/model: No such file or directory
Every 15 seconds, I get this error message when running tp-fancontrol -q
on Ubuntu Edgy on my T60.
I don't quite understand since /dev/hda
is my optical drive. The hard disk is /dev/sda
.
--Gunnar 11:32, 8 January 2007 (CET)
same problem with cat: /sys/block...
hi Gunnar,
does your tp-fancontrol also quit after a few minutes when running in daemon mode?
--Nilsja 01:20, 30 January 2007 (CET)
No, the deamon runs fine.
--Gunnar 13:43, 5 February 2007 (CET)
Script errors out
I tried using the fancontrol script, but it errored out on line 201:
tp-fancontrol.orig: line 201: syntax error near unexpected token `<'
tp-fancontrol.orig: line 201: ` read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < <(echo "$THERMAL") '
I searched the revision history, and taking out a previous change made the script work again:
--- tp-fancontrol.orig 2007-02-01 13:33:25.000000000 +0100
+++ tp-fancontrol 2007-02-01 13:35:25.000000000 +0100
@@ -197,9 +197,15 @@
thermometer() { # output list of temperatures
# 8 basic temperatures from ibm-acpi:
-r $IBM_ACPI/thermal || { echo "$0: Cannot read $IBM_ACPI/thermal" 2>&1 ; exit 1; }
- read THERMAL < $IBM_ACPI/thermal
- read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < <(echo "$THERMAL")
- "$X" == "temperatures:" || { echo "$0: Bad readout: \"$THERMAL\"" >&2; exit 1; }
+## Newer code, that did not seem to work here...
+# read THERMAL < $IBM_ACPI/thermal
+# read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < echo "$THERMAL"
+# "$X" == "temperatures:" || { echo "$0: Bad readout: \"$THERMAL\"" >&2; exit 1; }
+
+## Older code...
+ read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < $IBM_ACPI/thermal
+ "$X" == "temperatures:" || { echo "$0: Bad temperatures: $X $Y $Z" >&2; exit 1; }
+
echo -n "$Y1 $Y2 $Y3 $Y4 $Y5 $Y6 $Y7 $Y8 ";
# 3 extra temperatures from ibm_acpi:
if -n "$Z1" && -n "$Z2" && -n "$Z3" ; then
@@ -422,4 +428,4 @@
[ -e "$PID_FILE" ] && echo "WARNING: daemon already running"
set_priority
control_fan
By the way, I tested this script using glxgears, so cpu went to 100% (kernel 2.6.18.6, fglrx driver, t43p), and saw gpu-temperature go up to 86 degrees, at which point I quit glxgears. I thought this was a bit high...
--PJBrs 13:47, 01 February 2007 (CET)
T60 temperature thresholds?
Does someone have reasonable thresholds for T60 with T5600 / X1400?
--Burp 15:18, 23 February 2007 (CET)
Am I doing something wrong?
I just tried version 3.02 of the tp-fancontrol script, but I still get:
# sh Packages/tp-fancontrol-3.02 Packages/tp-fancontrol-3.02: line 201: syntax error near unexpected token `<' Packages/tp-fancontrol-3.02: line 201: ` read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < <(echo "$THERMAL") '
I'm not good enough at scripting to figure out why it's erroring out. This is on Slackware 11. Any suggestions?
--PJBrs - 19 March 2007
Probably your /bin/bash is too old.
--Thinker 15:49, 19 March 2007 (CET)
Hi Thinker, I just checked, and as of this morning I'm running bash 3.2.015, which seems to be the newest version, and I had the same error. Still, the script is running very nice by reverting one change around line 201 (see the above patch). Unfortunately I have only the faintest idea of what line 201 tries to accomplish, and no idea how to change it. Anyone else have the same problem?
--PJBrs - 26 March 2007
That line tells the read command to read its input from the file descriptor which serves as the output of the echo command. In other words, it's similar to "echo ... | read ...", except that the latter forgets the read data (because they way bash forking works).
Anyway, try this on your bash:
read X < <(echo foo); echo $X
On bash 3.1.17 it says foo.
--Thinker 01:57, 27 March 2007 (CEST)
It says foo for me (using the bash 3.1.17 too (on debian testing), but the script brakes at line 201 anyway...
I also have no /sys/block/hda/device/model even my harddrive is hda. "hdparm -i /dev/hda" shows the model and "hdparm -H" works without a problem. Model is HTS421212H9AT00
--BDKMPSS May 26 2007
As of today I switched to the libata driver and get a /sys/block/sda/device/model "file" I hacked my script to read the HDD-temp if it found my model (see above) and everything works without any problem.
the script also runs fine without braking at line 201, but I really can't figure out why. Still the same bash, most library's unchanged... some debian-testing update should have fixed this...
--BDKMPSS July 02 2007
Update t60-fancontrold
Hi,
I updated t60-fancontrold to work with ibm_acpi 0.13 (kernel >= 2.6.20) and supported the new level and watchdog command features. You can download t60-fancontrold-0.1.6.1 from http://hobbes.gmxhome.de (.tar.gz and SuSE .rpm). All changes seem to work fine for me, if you find any bugs, please report them (see file README).
Cheers,
--nick 19:33, 1 May 2007 (CEST)
Limiting/lowering CPU clock during temperature emergency
Recently I had to have my T41's mainboard replaced. This fixed a number of problems, but since then I've been experiencing system overheating. Basically, anything that pegs the CPU overheats the machine, and the kernel shuts it down. This can be a kernel compile, an overzealous java application, or even just Debian regenerating a font cache. The fan runs fine, I have cleared out any dust, and the heatsink appears to be on properly. Since my machine is out of warranty, I just have to make do.
I've discovered that if I throttle my cpufreq governor, I don't have this problem. That is, my 1.6GHz machine has a second frequency of 1.2GHz. If I run at 1.2GHz, I don't overheat. However, it does make everything a little slower. I would like to have 1.6GHz when Firefox wants to spike, but 1.2GHz when my compile is threatening to overheat the machine.
I have modified tp-fancontrol to do this. I grabbed 0.3.02, the latest on this page. I then taught it the -H option. You pass the throttling frequency in KHz, because that's what all the cpufreq knobs use. If you do not provide the -H option, tp-fancontrol does not touch the cpu frequencies.
Here's how it works. When tp-fancontrol decides the system needs the maximum fan speed, it also sets the governor's maximum frequency to the throttle frequency. The governor is free to act as it always does, but it will not use a frequency higher than the throttle frequency. When the fan speed is reduced, the governor's maximum frequence will be set back to the hardware's maximum. Upon exit, the hardware maximum will be restored as well.
I have also modifed tp-fancontrol.conf to allow specifying the throttle frequency and tp-fancontrol.init to pass the frequency on to tp-fancontrol. I'm running this on my Debian machine right now.
The scripts are at http://jlbec.org/software/misc/tp-fancontrol-cpu-throttle.tar.gz
I realize that most machines will have no trouble cooling themselves at their maximum frequency. I just wanted to put this out there in case anyone else had a similar problem, or if folks wanted to help their system cool down from maximum temperature.
-- jlbec 2007.05.10 @ 18:06 PDT
I changed the title to some other phrasing to avoid confusion with the ACPI T-states.
Also, you might want to buy some extremely high quality thermal compound (but not that one that corrodes aluminium!), remove your fan assembly and heatsink assembly, clean it up (and also all chipsets it touches) completely, and apply the new compound in a very thin and smooth layer. Make extremely sure the heatsink assembly is sitting very tightly over the new thermal compound. That might well fix your overheating problems for good...
I am not an user of tp-fancontrol, so maybe it already does this but still, check it to make sure it is setting the fan to the disengaged/full-speed fan level when you hit the emergency threshold, as that is much faster than the normal highest speed of the fan.
--hmh 09:14, 12 May 2007 (CEST)
No problem on the title change.
I've pulled off the heatsink and checked the thermal compound looks good. I've tested with disengaged, still doesn't keep the laptop from overheating :-(
-- jlbec 2007.05.11 @ 00:35 PDT
fan pulsing noise on X31 despite tp-fancontrol
Hi everybody. I use tp-fancontrol to run my fan on my X31, but the noise when the fan pulses every 4 seconds is still here. However, the ACPI fan control script webpage on Thinkwiki says that I can adapt the script to my X31 : Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them. I have looked everywhere, even through the scripts to try to discover what I could modify myself, but I did not find anything. Could someone tell me what I could do to solve this issue concerning my fan pulsing noise ? Thanks in advance.
-- MetallicDuck, 28 July 2007 @ 6:05 PM (CEST)
absolutely the same fault here... I tried some hours to make this work, even changing the actual code, but also have no solution. Maybe the embedded controler is not so foolish like "the other ones"...
-- BDKMPSS, 29 July 2007