2013-11-25 23:41:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#ftpfct : Fucking ThinkPad FanConTrol
|
|
|
|
# Yep, fancontrol works shit on my machine (kernel fault I think), so let's use
|
|
|
|
# ACPI and "kernel controls" (from TP_smapi).
|
|
|
|
|
|
|
|
FANFILE=/proc/acpi/ibm/fan
|
|
|
|
|
|
|
|
ACPI='acpi -V'
|
|
|
|
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=10
|
|
|
|
|
2013-11-25 23:41:43 +00:00
|
|
|
function set_fan
|
|
|
|
{
|
2014-01-02 22:55:00 +00:00
|
|
|
echo "level $1" | sudo tee $FANFILE
|
2013-11-25 23:41:43 +00:00
|
|
|
}
|
|
|
|
|
2013-11-26 20:13:30 +00:00
|
|
|
function finish
|
|
|
|
{
|
|
|
|
set_fan full-speed
|
|
|
|
}
|
|
|
|
|
|
|
|
trap finish EXIT
|
|
|
|
|
2013-11-25 23:41:43 +00:00
|
|
|
while true; do
|
|
|
|
|
|
|
|
TEMP=$($ACPI | grep degrees | grep -v critical | cut -d' ' -f4)
|
|
|
|
TEMP=$(echo $TEMP | cut -d. -f1)
|
|
|
|
echo $TEMP °C
|
|
|
|
|
|
|
|
#TODO: hysteresis if it becomes fucking annoying jumping around
|
|
|
|
|
|
|
|
if [ $TEMP -lt 10 ]; then
|
|
|
|
xsetroot PROC PROBLEM
|
|
|
|
set_fan full_speed
|
|
|
|
echo "full speed"
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=10
|
2013-11-25 23:41:43 +00:00
|
|
|
elif [ $TEMP -lt 46 ]; then
|
|
|
|
set_fan 0
|
|
|
|
echo "lt 46"
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=10
|
2013-11-25 23:41:43 +00:00
|
|
|
elif [ $TEMP -lt 56 ]; then
|
|
|
|
set_fan 1
|
|
|
|
echo "lt 56"
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=5
|
2013-11-25 23:41:43 +00:00
|
|
|
elif [ $TEMP -lt 66 ]; then
|
2013-11-26 20:13:30 +00:00
|
|
|
set_fan 2
|
|
|
|
echo "lt 66"
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=4
|
2013-11-26 20:13:30 +00:00
|
|
|
elif [ $TEMP -lt 70 ]; then
|
2013-11-25 23:41:43 +00:00
|
|
|
set_fan 5
|
|
|
|
echo "lt 66"
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=3
|
2013-11-25 23:41:43 +00:00
|
|
|
else
|
|
|
|
set_fan full-speed
|
|
|
|
echo "full speed"
|
2013-12-02 22:37:14 +00:00
|
|
|
REFRESH=2
|
2013-11-25 23:41:43 +00:00
|
|
|
fi;
|
|
|
|
|
2013-12-02 22:37:14 +00:00
|
|
|
sleep $REFRESH
|
2013-11-25 23:41:43 +00:00
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|