ftpfct: Fucking ThinkPad FanControl script

This commit is contained in:
Frank Villaro-Dixon 2013-11-26 00:41:43 +01:00
parent 873bf3b677
commit 54e4d24740

46
Utils/ftpfct.sh Executable file
View file

@ -0,0 +1,46 @@
#!/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'
function set_fan
{
echo "level $1" | sudo tee $FANFILE > /dev/null
}
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"
elif [ $TEMP -lt 46 ]; then
set_fan 0
echo "lt 46"
elif [ $TEMP -lt 56 ]; then
set_fan 1
echo "lt 56"
elif [ $TEMP -lt 66 ]; then
set_fan 5
echo "lt 66"
else
set_fan full-speed
echo "full speed"
fi;
sleep 10
done