[ltp] Fan management for thinkpad

Paul RIVIER linux-thinkpad@linux-thinkpad.org
Mon, 11 Jul 2005 12:46:54 +0200


This is a multi-part message in MIME format.
--------------050802000102020705090104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I wrote a script as to manage the fan behavior (ibm_manage_fan.sh), it
is really easy to use so I give it to you as it is :)
It is associated with an init script (ibm_fan_rc), as to manage it in a
proper maner.
Using this your fan will run only if necessary.
!!! Check on the ibm-acpi homepage that your laptop is supported for fan 
control !
I plan to work on ibm-acpi module as soon as I get free time :)


Paul


--------------050802000102020705090104
Content-Type: text/plain;
 name="ibm_fan_rc"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ibm_fan_rc"

#!/bin/sh
#
# Please copy this file in /etc/init.d and make it executable
 
# description: Starts and stop ibm_manage_fan as to control the fan on ibm thinkpads
# Read /usr/sbin/ibm_manage_fan.sh !
 

if [ ! -f /proc/acpi/ibm/fan ] ; then
	echo "Please use ibm-acpi 0.11 or higher, with experimental=1"
	exit -1
fi

if [ ! -f /usr/sbin/ibm_manage_fan.sh -a -x /usr/sbin/ibm_manage_fan.sh ] ; then 
	echo "Please copy ibm_manage_fan in /usr/sbin and make it executable"
	exit -1
fi

# Enable ibm_manage_fan when the system is booted

case $1 in
  start)
    if [ -f /var/run/ibm-manage-fan-enabled ] ; then
	echo "Thinkpad fan management is already running ..."
	exit 0
    fi
    echo -n "Initializing thinkpad fan management ... "
    touch /var/run/ibm-manage-fan-enabled
    /usr/sbin/ibm_manage_fan.sh &
    echo "done."
    exit 0
    ;;

  restart|reload|force-reload)
    set -e
    echo -n "Restarting thinkpad fan management... "
    $0 stop > /dev/null
    $0 start > /dev/null
    echo "done."
    exit 0
    ;;

  stop)
    echo -n "Stopping thinkpad fan management ... "
    rm -f /var/run/ibm-manage-fan-enabled
    sleep 5
    echo -n enable > /proc/acpi/ibm/fan
    echo "done."
    exit 0
    ;;

  *)
      echo "Usage: $0 {stop|start|restart|reload|force-reload}" >&2
      exit 1
    ;;
esac



--------------050802000102020705090104
Content-Type: application/x-shellscript;
 name="ibm_manage_fan.sh"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="ibm_manage_fan.sh"

IyEvYmluL3NoCgojIGlibV9tYW5hZ2VfZmFuIHdyaXR0ZW4gYnkgUGF1bCBSSVZJRVIgKHBh
dWwucml2aWVyQGVsZXZlLmVtbi5mcikKIyB2ZXJzaW9uIDAuMQojIFVuZGVyIEdQTAoKIyBU
aGlzIHNjcmlwdCBwZXJtaXRzIHRvIG1hbmFnZSB0aGUgZmFuCiMgRG8gbm90IHVzZSBpdCBh
bG9uZSAhIE11c3QgYmUgbGF1bmNoIGJ5IHRoZSBpbml0IHNjcmlwdCBpYm1fZmFuX3JjCiMg
UGVhc2UgY29weSB0aGlzIGZpbGUgdG8gL3Vzci9zYmluIGFuZCBtYWtlIGl0IGV4ZWN1dGFi
bGUuCgojIEl0IHJlcXVpcmVzIGlibS1hY3BpIDAuMTEgb3IgaGlnaGVyLCB3aXRoIG1vZGUg
ZXhwZXJpbWVudGFsPTEKIyAhISEhISBCRSBDQVJFRlVMICEhISBTdG9wcGluZyB0aGUgZmFu
IGNhbiBkYW1hZ2UgdGhlIGNvbXB1dGVyCiMgRG8gbm90IHVzZSBpZiB5b3UgZG8gbm90IG1v
bml0b3IgeW91ciBjb21wdXRlcgojIEtub3duIHRvIHdvcmsgb24gVDQyIG9ubHkKIyBVc2Ug
aXQgYXQgeW91ciBvd24gcmlza3MKIyAhISEhIQoKIyB5b3UgY2FuIHR3ZWFrIHRoZSBmb2xs
b3dpbmcgNSB2YWx1ZXMKIyB0aGUgZmFuIGlzIHN0YXJ0ZWQgaWYgQ1BVIHRlbXBlcmF0dXJl
IGJlY29tZXMgZ3JlYXRlciB0aGFuIE1BWF9DUFVfVEVNUAojIG9uY2UgbGF1bmNoZWQgdGhl
IGZhbiBzdGF5IHJ1bm5pbmcgdW50aWwgdGhlIENQVSBnb2V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