paul- wrote: 
> Some use a user space program,  but There is fan control in the
> kernel..... not sure if they use this or not?

This is the part to create the daemon for temperature checking (it is
running as a service later:

Code:
--------------------
    echo 'def temp_check():' >> $powerbuttonscript
  echo '        fanconfig = ["65=100", "60=55", "55=10"]' >> $powerbuttonscript
  echo '        tmpconfig = load_config("'$daemonconfigfile'")' >> 
$powerbuttonscript
  echo '        if len(tmpconfig) > 0:' >> $powerbuttonscript
  echo '                fanconfig = tmpconfig' >> $powerbuttonscript
  echo '        address=0x1a' >> $powerbuttonscript
  echo '        prevblock=0' >> $powerbuttonscript
  echo '        while True:' >> $powerbuttonscript
  echo '                temp = os.popen("vcgencmd measure_temp").readline()' >> 
$powerbuttonscript
  echo '                temp = temp.replace("temp=","")' >> $powerbuttonscript
  echo '                val = float(temp.replace("'"'"'C",""))' >> 
$powerbuttonscript
  echo '                block = get_fanspeed(val, fanconfig)' >> 
$powerbuttonscript
  echo '                if block < prevblock:' >> $powerbuttonscript
  echo '                        time.sleep(30)' >> $powerbuttonscript
  echo '                prevblock = block' >> $powerbuttonscript
  echo '                try:' >> $powerbuttonscript
  echo '                        bus.write_byte(address,block)' >> 
$powerbuttonscript
  echo '                except IOError:' >> $powerbuttonscript
  echo '                        temp=""' >> $powerbuttonscript
  echo '                time.sleep(30)' >> $powerbuttonscript
  
--------------------


They are reading the temperature with "vcgencmd measure_temp" and if it
reaches the next step from the config they call this:

Code:
--------------------
    bus.write_byte(address,block)
--------------------

where address is 0x1a and block is the fanspeed from config.

I don't know what this bus.write_byte is doing. Maybe it is enough to
write this a single time to have the fan running always at the same
speed?


------------------------------------------------------------------------
carsten_h's Profile: http://forums.slimdevices.com/member.php?userid=69113
View this thread: http://forums.slimdevices.com/showthread.php?t=110727

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to