Soekris 6501 (and other boards?) temperature fix



  • Hi,

    in some other thread I found a nice Soekris board setup guide with an important hint that the shown CPU core temperature is wrong in FreeBSD because CPU core is not recognized and therefore max temperature of 100°C is assumend (whew … we were wondering how hot it was...)

    http://doc.pfsense.org/index.php/Soekris_6501_USB_Flash_installation#CPU_Temperature

    the first modification with return=true is not needed anymore for pfSense 2.1
    But I saw that also the widget shows wrong temperature...

    So here the patch for both functions ready for copy&paste into patches module ;)

    --- /usr/local/www/includes/functions.inc.php.orig	2013-09-12 00:20:12.000000000 +0200
    +++ /usr/local/www/includes/functions.inc.php	2013-12-11 19:42:36.000000000 +0100
    @@ -186,6 +186,9 @@
     		$temp_out = trim($dfout[0]);
     	}
    
    +	// adjust for wrong tijmax in Soekris 6501 board
    +	$temp_out = (intval($temp_out) - 10) . '.0';
    +
     	return $temp_out;
     }
    
    --- /usr/local/www/widgets/include/thermal_sensors.inc.orig	2013-09-12 00:20:12.000000000 +0200
    +++ /usr/local/www/widgets/include/thermal_sensors.inc	2013-12-11 19:39:59.000000000 +0100
    @@ -20,6 +20,11 @@
     function getThermalSensorsData() {
    
     	exec("/sbin/sysctl -a | grep temperature", $dfout);
    +	// adjust for wrong tijmax in Soekris 6501 board
    +	for ($i = 0; $i < count($dfout); $i++) {
    +		$lineArray     = preg_split('/[\sC:]+/', $dfout[$i], 2);
    +		$dfout[$i]     = sprintf ("%s: %2.1fC", $lineArray[0], $lineArray[1]-10);
    +	}
     	$thermalSensorsData = join("|", $dfout);
     	return $thermalSensorsData;