Talk:Fan control scripts

From ThinkWiki
Revision as of 00:57, 27 March 2007 by Thinker (Talk | contribs) (Am I doing something wrong?)
Jump to: navigation, search

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)


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.

Hint:
If you followed a link here looking for thermal sensor information, see the article page and the page on thermal sensors.

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)