You are not logged in.

#1 2011-05-04 15:08:33

AbtZ
Member
Registered: 2008-05-30
Posts: 31

fancontrol: Maximum fan speed at boot and shutdown

So I've followed the fan speed guide on the Arch Wiki and have gotten the fan in my laptop to work perfectly -- except for one thing. For a short time during boot, and a somewhat longer time during shutdown, my fan runs at MAXIMUM speed.

I've noticed that when I run fancontrol from the terminal, and then abort the program with Ctrl+C, it outputs "Verify fans have returned to full speed", so I assume this is where the problem lies. Is there a simple way (config file) to change the program so that it restores the fans to a saner speed on exit?

Offline

#2 2011-05-04 15:16:27

AbtZ
Member
Registered: 2008-05-30
Posts: 31

Re: fancontrol: Maximum fan speed at boot and shutdown

I assume the solution lies in modifying the file /usr/sbin/fancontrol, especially in this part:

function restorefans()
{
        local status=$1
        echo 'Aborting, restoring fans...'
        let fcvcount=0
        while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
        do
                pwmo=${AFCPWM[$fcvcount]}
                pwmdisable $pwmo
                let fcvcount=$fcvcount+1
        done
        echo 'Verify fans have returned to full speed'
        rm -f "$PIDFILE"
        exit $status
} 

My scripting skills are not so great, however, so I'm not sure how to modify it. I would prefer it so set a pwm of maybe 100, instead of 255.

Offline

#3 2012-10-29 16:15:13

yutao
Member
Registered: 2012-10-29
Posts: 1

Re: fancontrol: Maximum fan speed at boot and shutdown

The previous answer is very helpful. While the fancontrol script catches a quit signal, it calls restorefans function. And that function will further call pwmdisable. pwmdisable function is the actual place where fancontrol set fan speed before it exits. In the pwmdisable function, it first tries to return the fan speed control responsibility back to the system which should automatically adjust fan speed if bios supports auto pwm control. If failed, it set the fan to MAX speed.

Understanding this, it would not be too hard to modify the script. On my system, automatic fan control is enabled by setting pmw_enable to 5 (echo 5 > /sys/class/hwmon/hwmon1/device/pwm2_enable) rather than 0. So I modified lines between 330 to 332 to be

330     # Try pwmN_enable=5
331     echo 5 > $ENABLE 2> /dev/null
332     if [ `cat $ENABLE` -eq 5 ]

In the original script 5s are all replaced with 0s.

And if it does not work, you may try replacing $MAX and 190 in the following lines  to your preferred pwm

340     echo $MAX > $1
341     if [ `cat $ENABLE` -eq 1 -a `cat $1` -ge 190 ] 

And at last, do not forget backup before trying.

Offline

Board footer

Powered by FluxBB