Difference between revisions of "Talk:Fan control scripts"

From ThinkWiki
Jump to: navigation, search
(Am I doing something wrong?)
(fancontrol (in Perl, on GitHub): new section)
 
(21 intermediate revisions by 9 users not shown)
Line 24: Line 24:
  
 
--[[User:Micampe|Micampe]] 08:19, 12 Nov 2005 (CET)
 
--[[User:Micampe|Micampe]] 08:19, 12 Nov 2005 (CET)
 +
 +
The script works fine for me except that occasionally and for no reason (i.e., even when my T42 is idle) the fan will suddenly accelerate to level 2 for a couple of seconds, decelerate to level 0 for a couple of seconds, and then accelerate again.  This fast/slow fan behaviour then continues indefinitely.  The only way I can stop it is to stop the script and start it again.
 +
 +
Any tips/advice much appreciated.
 +
 +
[[User:Sebyte|Sebyte]] 08:04, 8 October 2008 (CEST)
  
 
== Sensor-specific variable-speed script ==
 
== Sensor-specific variable-speed script ==
Line 250: Line 256:
 
   thermometer() { # output list of temperatures
 
   thermometer() { # output list of temperatures
 
       # 8 basic temperatures from ibm-acpi:
 
       # 8 basic temperatures from ibm-acpi:
       [[ -r $IBM_ACPI/thermal ]] || { echo "$0: Cannot read $IBM_ACPI/thermal" 2>&1 ; exit 1; }
+
       [[ <nowiki>-r $IBM_ACPI/thermal</nowiki> ]] || { echo "$0: Cannot read $IBM_ACPI/thermal" 2>&1 ; exit 1; }
 
  -    read THERMAL < $IBM_ACPI/thermal
 
  -    read THERMAL < $IBM_ACPI/thermal
 
  -    read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < <(echo "$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; }
+
  -    [[ <nowiki>"$X" == "temperatures:"</nowiki> ]] || { echo "$0: Bad readout: \"$THERMAL\"" >&2;  exit 1; }
 
  +## Newer code, that did not seem to work here...
 
  +## Newer code, that did not seem to work here...
 
  +#    read THERMAL < $IBM_ACPI/thermal
 
  +#    read THERMAL < $IBM_ACPI/thermal
 
  +#    read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < echo "$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; }
+
  +#    [[ <nowiki>"$X" == "temperatures:"</nowiki> ]] || { echo "$0: Bad readout: \"$THERMAL\"" >&2;  exit 1; }
 
  +
 
  +
 
  +## Older code...
 
  +## Older code...
 
  +    read X Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Z1 Z2 Z3 JNK < $IBM_ACPI/thermal
 
  +    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; }
+
  +    [[ <nowiki>"$X" == "temperatures:"</nowiki> ]] || { echo "$0: Bad temperatures: $X $Y $Z" >&2; exit 1; }
 
  +
 
  +
 
       echo -n "$Y1 $Y2 $Y3 $Y4 $Y5 $Y6 $Y7 $Y8 ";
 
       echo -n "$Y1 $Y2 $Y3 $Y4 $Y5 $Y6 $Y7 $Y8 ";
 
       # 3 extra temperatures from ibm_acpi:
 
       # 3 extra temperatures from ibm_acpi:
       if [[ -n "$Z1" && -n "$Z2" && -n "$Z3" ]]; then
+
       if [[ <nowiki>-n "$Z1" && -n "$Z2" && -n "$Z3"</nowiki> ]]; then
 
  @@ -422,4 +428,4 @@
 
  @@ -422,4 +428,4 @@
 
       [ -e "$PID_FILE" ] && echo "WARNING: daemon already running"
 
       [ -e "$PID_FILE" ] && echo "WARNING: daemon already running"
Line 323: Line 329:
  
 
--[[User:BDKMPSS|BDKMPSS]] May 26 2007
 
--[[User:BDKMPSS|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...
 +
 +
--[[User:BDKMPSS|BDKMPSS]] July 02 2007
 
----
 
----
  
Line 366: Line 379:
  
 
-- jlbec 2007.05.11 @ 00:35 PDT
 
-- 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"...
 +
 +
-- [[User:BDKMPSS|BDKMPSS]], 29 July 2007
 +
 +
Happy to know that I m not alone :) . My Thinkpad X31 have a BIOS v. 3.02 and an embedded controller v. 1.03. Does anyone who has upgraded the BIOS or the embedded controller has noticed some better behavior of the fan concerning the pulsing noise ?
 +
 +
-- MetallicDuck, 29 July 2007 @ 1:22 PM (CEST)
 +
 +
No I use (like always) the latest greatest (3.02/1.08), which fixed some other long forgotten problems, but not the fan pulsing.
 +
 +
-- [[User:BDKMPSS|BDKMPSS]], 29 July 2007
 +
 +
== patch for tp-fancontrol to monitor thermal_zone ==
 +
 +
tp-fancontrol does not monitor acpi/thermal_zone which is no problem on most thinkpads, but on a T60 THM1 is the real CPU temp, which is not available via IBM/thermal.
 +
 +
So this patch does also monitor these two.
 +
 +
<pre>
 +
--- tp-fancontrol      2007-11-12 16:39:41.000000000 +0100
 +
+++ tp-fancontrol.new  2007-11-12 16:45:57.000000000 +0100
 +
@@ -47,6 +47,9 @@
 +
 +
  47  58    #  HDD        ->      ->    ->    Hard disk internal sensor
 +
  47  60    #  HDAPS      ->      ->    ->    HDAPS readout (same as EC 0x79)
 +
+
 +
+  45  60    #  THERMAL0
 +
+  55  70    #  THERMAL1 
 +
)
 +
 +
 +
@@ -216,7 +219,17 @@
 +
    if [ -r $HDAPS_TEMP ]; then
 +
        Y="`cat $HDAPS_TEMP`"
 +
        (( "$Y" > 100 )) || echo -n "$Y "  # the HDAPS readouts are nonsensical right after resume
 +
+    else
 +
+      echo -n "-128 "
 +
    fi
 +
+   
 +
+    # thermal_zone
 +
+    echo -n "$SEP "
 +
+    for THM in 0 1; do
 +
+      cat $IBM_ACPI/../thermal_zone/THM${THM}/temperature | perl -ne 'm/(\d+)/; print $1'
 +
+      echo -n " "
 +
+    done
 +
 +
    return 0
 +
}
 +
 +
</pre>
 +
[[User:Urandom|Urandom]] 17:07, 13 November 2007 (UTC)
 +
 +
== Improvements for t60-fancontrold  ==
 +
 +
Hi Nick,
 +
 +
I made one simple improvement, which allows the fan to run disengaged (fastest) when the temperature is really critical.  I need that because whenever I start a really heavy multithreaded compilation my machine eventually shuts down to protect itself, with this in the log. and I think I may have corrected a small bug in the code where it tries to disengage briefly. 
 +
 +
<pre>
 +
--- ../t60-fancontrold 2008-04-25 10:21:09.462753198 -0400
 +
+++ t60-fancontrold 2008-04-25 10:21:57.679070003 -0400
 +
@@ -60,9 +60,9 @@
 +
HAVE_WATCHDOG_CMD=
 +
WATCHDOG_DELAY=15
 +
 +
-FAN_LEVELS=(0  2  4  7)
 +
-ANTIPULSE=( 0  1  1  0 )  # Prevent fan pulsing noise at this level
 +
-                            # (reduces frequency of fan RPM updates)
 +
+FAN_LEVELS=(0  2  4  7 8)
 +
+ANTIPULSE=( 0  1  1  0 0 )  # Prevent fan pulsing noise at this level
 +
+                                # (reduces frequency of fan RPM updates)
 +
 +
NUMBER_FAN_LEVELS=${#FAN_LEVELS[@]}
 +
 +
@@ -873,11 +873,17 @@
 +
 +
    if ! ${DRY_RUN} && ! ${EXIT_SIGNALLED} ; then
 +
    if ${HAVE_LEVEL_CMD} ; then
 +
+            if [ ${arg} -eq 8 ]; then
 +
+                arg=disengaged
 +
+            fi
 +
    if ! echo "level ${arg}" > ${ACPI_FAN} ; then
 +
    log "ERROR: Setting fan level failed."
 +
    exit 1
 +
    fi
 +
    else
 +
+            if [ ${arg} -eq 8 ]; then
 +
+                arg=0x40
 +
+            fi
 +
if ! echo 0x2F ${arg} > ${ACPI_ECDUMP} ; then
 +
    log "ERROR: Writing to ${ACPI_ECDUMP} failed."
 +
    exit 1
 +
@@ -1111,7 +1117,7 @@
 +
if [ ${SETTLE_LEFT} -ge 0 ]; then
 +
    SETTLE_LEFT=$(( SETTLE_LEFT-INTERVAL ))
 +
else
 +
-     set_fan_level 0x40 # disengage briefly to fool embedded controller
 +
+     set_fan_level 8 # disengage briefly to fool embedded controller
 +
    sleep 0.5
 +
    RESETTLE_LEFT=$(( RESETTLE_LEFT-INTERVAL ))
 +
fi
 +
</pre>
 +
 +
One problem I'm having is that my T60p seems to have different thermal zones than your T60, since my fan immediately maxes out due to BAT0.  With no particularly great load, I am seeing
 +
 +
  t60-fancontrold: INFO: Temperatures at startup are: 58 40 36 78 50 -128 27 -128
 +
  t60-fancontrold: INFO: Additional thermal sensors found. Temperature values are: 41 56 56 -128 -128 -128 -128 -128
 +
 +
So I need to figure out how to account for that.
 +
 +
Some further improvements I would really like to see:
 +
 +
* set the frequencyc scaling governor to powersave or conservative before the temperature becomes truly critical
 +
* adjust for the new kernel docking station support, since /proc/acpi/ibm/dock is no longer supported
 +
 +
I'd be more than happy to work with you on any of these.
 +
--[[User:Dave abrahams|Dave abrahams]] 17:01, 25 April 2008 (CEST)
 +
 +
== New t60-fancontrold release ==
 +
 +
Dear all,
 +
 +
I released a new version of t60-fancontrold (0.1.7) that should support both older and newer kernels. I tested it on Fedora 7 with kernel 2.6.23.17-88 and it works fine for me.
 +
You can get it at
 +
 +
http://www.hobbes.gmxhome.de/t60-fancontrold/t60-fancontrold-0.1.7.tar.gz
 +
 +
Other notable changes include the addition of a Makefile, support for fan level 'disengaged' (for really critical temperatures, see last post above), init.d start scripts for Fedora and SuSE, and optional support for additional sensors. For all changes please have a look at the ChangeLog file and the README.
 +
 +
I'd appreciate feedback and bug reports (hopefully there are no major ones).
 +
 +
Best,  --[[User:Narend|nick]] 12:00, 8 June 2008 (CEST).
 +
 +
PS: I don't know much about the additional sensors on the T60, so the temperature values I chose might not be appropriate for all models. Please watch your temperatures if you use them!
 +
 +
 +
UPDATE: There's a new version 0.1.7.1 with fixes for the init.d stuff (see ChangeLog). Get it at
 +
 +
http://www.hobbes.gmxhome.de/t60-fancontrold/t60-fancontrold-0.1.7.1.tar.gz
 +
 +
--[[User:Narend|nick]] 11:10, 22 June 2008 (CEST)
 +
 +
== tp-fancontrol for X300? ==
 +
 +
 +
-- tp-fancontrol works for my X300, though I have no idea if an how I can change the code so it suits my model. I especially wonder about the levels in tp-fancontrol. Why don't you use level 1 for example? Can I only select 4 levels as in the code, or can I add all? At level 1 the fan is not noticeable (does it run at all? - cat /proc/acpi/ibm/fan shows "speed: 1820" at "level: 1", but also sometimes the same speed for level: 3, I therefore don't know if I can trust that information). Secondly I would like to know if I should adjust the min and max thresholds? Does anybody know which ones are good/safe for the X300?
 +
 +
Ben, 17:09, 7 March 2009 (CET)
 +
 +
== fancontrol (in Perl, on GitHub) ==
 +
 +
Hi. For small Perl script with daemon support see https://github.com/mj41/fancontrol Tested on my ThinkPad T410s with SSD disk (no needs/support for monitoring HDD temperature).
 +
--[[User:Mj41|Mj41]] 13:32, 25 March 2011 (CET)

Latest revision as of 13:32, 25 March 2011

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)

The script works fine for me except that occasionally and for no reason (i.e., even when my T42 is idle) the fan will suddenly accelerate to level 2 for a couple of seconds, decelerate to level 0 for a couple of seconds, and then accelerate again. This fast/slow fan behaviour then continues indefinitely. The only way I can stop it is to stop the script and start it again.

Any tips/advice much appreciated.

Sebyte 08:04, 8 October 2008 (CEST)

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)


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

Happy to know that I m not alone :) . My Thinkpad X31 have a BIOS v. 3.02 and an embedded controller v. 1.03. Does anyone who has upgraded the BIOS or the embedded controller has noticed some better behavior of the fan concerning the pulsing noise ?

-- MetallicDuck, 29 July 2007 @ 1:22 PM (CEST)

No I use (like always) the latest greatest (3.02/1.08), which fixed some other long forgotten problems, but not the fan pulsing.

-- BDKMPSS, 29 July 2007

patch for tp-fancontrol to monitor thermal_zone

tp-fancontrol does not monitor acpi/thermal_zone which is no problem on most thinkpads, but on a T60 THM1 is the real CPU temp, which is not available via IBM/thermal.

So this patch does also monitor these two.

--- tp-fancontrol       2007-11-12 16:39:41.000000000 +0100
+++ tp-fancontrol.new   2007-11-12 16:45:57.000000000 +0100
@@ -47,6 +47,9 @@
 
   47   58    #  HDD        ->      ->     ->     Hard disk internal sensor
   47   60    #  HDAPS      ->      ->     ->     HDAPS readout (same as EC 0x79)
+
+  45   60    #  THERMAL0
+  55   70    #  THERMAL1  
 )
 
 
@@ -216,7 +219,17 @@
     if [ -r $HDAPS_TEMP ]; then
         Y="`cat $HDAPS_TEMP`"
         (( "$Y" > 100 )) || echo -n "$Y "  # the HDAPS readouts are nonsensical right after resume
+    else
+       echo -n "-128 "
     fi
+    
+    # thermal_zone
+    echo -n "$SEP "
+    for THM in 0 1; do
+       cat $IBM_ACPI/../thermal_zone/THM${THM}/temperature | perl -ne 'm/(\d+)/; print $1'
+       echo -n " "
+    done
+   
     return 0
 }
 

Urandom 17:07, 13 November 2007 (UTC)

Improvements for t60-fancontrold

Hi Nick,

I made one simple improvement, which allows the fan to run disengaged (fastest) when the temperature is really critical. I need that because whenever I start a really heavy multithreaded compilation my machine eventually shuts down to protect itself, with this in the log. and I think I may have corrected a small bug in the code where it tries to disengage briefly.

--- ../t60-fancontrold	2008-04-25 10:21:09.462753198 -0400
+++ t60-fancontrold	2008-04-25 10:21:57.679070003 -0400
@@ -60,9 +60,9 @@
 HAVE_WATCHDOG_CMD=
 WATCHDOG_DELAY=15
 
-FAN_LEVELS=(0   2   4   7)
-ANTIPULSE=( 0   1   1   0 )  # Prevent fan pulsing noise at this level
-                             # (reduces frequency of fan RPM updates)
+FAN_LEVELS=(0   2   4   7	8)
+ANTIPULSE=( 0   1   1   0	0 )  # Prevent fan pulsing noise at this level
+                                 # (reduces frequency of fan RPM updates)
 
 NUMBER_FAN_LEVELS=${#FAN_LEVELS[@]}
 
@@ -873,11 +873,17 @@
 	
     if ! ${DRY_RUN} && ! ${EXIT_SIGNALLED} ; then
     	if ${HAVE_LEVEL_CMD} ; then
+            if [ ${arg} -eq 8 ]; then
+                arg=disengaged
+            fi
     		if ! echo "level ${arg}" > ${ACPI_FAN} ; then
     			log "ERROR: Setting fan level failed."
     			exit 1
     		fi
     	else
+            if [ ${arg} -eq 8 ]; then
+                arg=0x40
+            fi
 			if ! echo 0x2F ${arg} > ${ACPI_ECDUMP} ; then
 	    		log "ERROR: Writing to ${ACPI_ECDUMP} failed."
 	    		exit 1
@@ -1111,7 +1117,7 @@
 			if [ ${SETTLE_LEFT} -ge 0 ]; then
 		    	SETTLE_LEFT=$(( SETTLE_LEFT-INTERVAL ))
 			else
-		    	set_fan_level 0x40 # disengage briefly to fool embedded controller
+		    	set_fan_level 8 # disengage briefly to fool embedded controller
 		    	sleep 0.5
 		    	RESETTLE_LEFT=$(( RESETTLE_LEFT-INTERVAL ))
 			fi

One problem I'm having is that my T60p seems to have different thermal zones than your T60, since my fan immediately maxes out due to BAT0. With no particularly great load, I am seeing

 t60-fancontrold: INFO: Temperatures at startup are: 58 40 36 78 50 -128 27 -128
 t60-fancontrold: INFO: Additional thermal sensors found. Temperature values are: 41 56 56 -128 -128 -128 -128 -128

So I need to figure out how to account for that.

Some further improvements I would really like to see:

  • set the frequencyc scaling governor to powersave or conservative before the temperature becomes truly critical
  • adjust for the new kernel docking station support, since /proc/acpi/ibm/dock is no longer supported

I'd be more than happy to work with you on any of these. --Dave abrahams 17:01, 25 April 2008 (CEST)

New t60-fancontrold release

Dear all,

I released a new version of t60-fancontrold (0.1.7) that should support both older and newer kernels. I tested it on Fedora 7 with kernel 2.6.23.17-88 and it works fine for me. You can get it at

http://www.hobbes.gmxhome.de/t60-fancontrold/t60-fancontrold-0.1.7.tar.gz

Other notable changes include the addition of a Makefile, support for fan level 'disengaged' (for really critical temperatures, see last post above), init.d start scripts for Fedora and SuSE, and optional support for additional sensors. For all changes please have a look at the ChangeLog file and the README.

I'd appreciate feedback and bug reports (hopefully there are no major ones).

Best, --nick 12:00, 8 June 2008 (CEST).

PS: I don't know much about the additional sensors on the T60, so the temperature values I chose might not be appropriate for all models. Please watch your temperatures if you use them!


UPDATE: There's a new version 0.1.7.1 with fixes for the init.d stuff (see ChangeLog). Get it at

http://www.hobbes.gmxhome.de/t60-fancontrold/t60-fancontrold-0.1.7.1.tar.gz

--nick 11:10, 22 June 2008 (CEST)

tp-fancontrol for X300?

-- tp-fancontrol works for my X300, though I have no idea if an how I can change the code so it suits my model. I especially wonder about the levels in tp-fancontrol. Why don't you use level 1 for example? Can I only select 4 levels as in the code, or can I add all? At level 1 the fan is not noticeable (does it run at all? - cat /proc/acpi/ibm/fan shows "speed: 1820" at "level: 1", but also sometimes the same speed for level: 3, I therefore don't know if I can trust that information). Secondly I would like to know if I should adjust the min and max thresholds? Does anybody know which ones are good/safe for the X300?

Ben, 17:09, 7 March 2009 (CET)

fancontrol (in Perl, on GitHub)

Hi. For small Perl script with daemon support see https://github.com/mj41/fancontrol Tested on my ThinkPad T410s with SSD disk (no needs/support for monitoring HDD temperature). --Mj41 13:32, 25 March 2011 (CET)