[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

/proc/therm have unstable content



The content of /proc/therm sometimes changes without anyone running
set_therm to modify the HI and LOW values.

I can see this when cat'ing the content, and suddenly it will go from

  Thermostat: HI 50.0, LOW 44.0; temperature: 43.5 C, fan on

to 

  Thermostat: HI 1.0, LOW 0.0; temperature: 43.5 C, fan on

Do anyone have any idea why this happens?

I'm running this small script to make sure the fan stops when the
temperature is below a given threshold.  My fan gives a lot of noice,
so I want to turn it off as much as possible.  This is the script:

#!/usr/bin/perl -w
#
# Author: Petter Reinholdtsen <pere@td.org.uit.no>
#
# Check Netwinder themperature, and turn on fan if it is to high.

my $debug = 0;

sub get_themp {
    open(THEMP, "< /proc/therm") || die "Unable to open /proc/therm";
    my $line = <THEMP>;
    close(THEMP);
    my ($hi, $lo, $therm) = $line =~
        m/Thermostat: HI (\S+), LOW (\S+); temperature: (\S+) C, fan /;
    return $hi, $lo, $therm;
}

while (1) {
    my ($hi, $lo, $therm) = get_themp();
    my $foo = $lo - (($hi - $lo) / 2.0);
    print "Got $hi > $lo > $foo ? $therm\n" if $debug;
    if ($therm <= $foo) {
        print "Below or equal to $foo, stopping fan\n" if $debug;
        `fan_ctrl off`;
    } elsif ($therm > $hi) {
        print "Above hi, starting fan\n" if $debug;
        `fan_ctrl on`;
    } elsif ($therm >= $lo) {
        print "Above or equal to lo $lo, starting fan\n" if $debug;
        `fan_ctrl start`;
    }
    sleep(5);
}


-- 
To UNSUBSCRIBE, email to debian-arm-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: