remove
This commit is contained in:
parent
5c1326a544
commit
8be2dd79b0
@ -1,101 +0,0 @@
|
||||
Menu="IPMI:2"
|
||||
Title="Fan Control"
|
||||
---
|
||||
<?
|
||||
$plugin = "ipmitool-plugin";
|
||||
$cfg = parse_plugin_cfg($plugin);
|
||||
$sName = "autofan";
|
||||
$fName = "/usr/local/emhttp/plugins/$plugin/scripts/$sName";
|
||||
|
||||
function temp_val($val) {
|
||||
global $display;
|
||||
return $display['unit']=='C' ? $val : round(9/5*$val+32);
|
||||
}
|
||||
function scan_dir($dir, $type = "") {
|
||||
$out = array();
|
||||
foreach (array_slice(scandir($dir), 2) as $entry){
|
||||
$sep = (preg_match("/\/$/", $dir)) ? "" : "/";
|
||||
$out[] = $dir.$sep.$entry ;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
function list_pwm() {
|
||||
$out = array();
|
||||
exec("find /sys/devices -type f -iname 'pwm[0-9]' -exec dirname \"{}\" +|uniq", $chips);
|
||||
foreach ($chips as $chip) {
|
||||
$name = is_file("$chip/name") ? file_get_contents("$chip/name") : "";
|
||||
foreach (preg_grep("/pwm\d+$/", scan_dir($chip)) as $pwm) {
|
||||
$out[] = array('chip'=>$name, 'name'=>end(split('/',$pwm)), 'sensor'=>$pwm);
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
?>
|
||||
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<input type="hidden" name="#file" value="<?=$plugin?>/<?=$plugin?>.cfg">
|
||||
<input type="hidden" name="#include" value="plugins/<?=$plugin?>/include/update.autofan.php">
|
||||
<input type="hidden" name="#prefix" value="controller=c&fan=f&pwm=l&low=t&high=T&interval=m">
|
||||
<span class="bitstream" style="float:right;margin-right:12px"><?=exec("$fName -V")?></span>
|
||||
|
||||
Fan control function:
|
||||
: <select name="service" size="1">
|
||||
<?=mk_option($cfg['service'], "0", "Disabled")?>
|
||||
<?=mk_option($cfg['service'], "1", "Enabled")?>
|
||||
</select>
|
||||
|
||||
PWM controller:
|
||||
: <select name="controller" size="1">
|
||||
<?=mk_option($cfg['controller'], "", "None")?>
|
||||
<?foreach (list_pwm() as $pwm):?>
|
||||
<?=mk_option($cfg['controller'], $pwm['sensor'], "{$pwm['chip']} - {$pwm['name']}")?>
|
||||
<?endforeach;?>
|
||||
</select>
|
||||
|
||||
PWM fan:
|
||||
: <input type="text" name="fan" value="<?=$cfg['fan']?>" placeholder="Click DETECT"><input type="button" value="Detect" onclick="detectFan();" id="fan" style="margin-top:0">
|
||||
|
||||
Minimun PWM value:
|
||||
: <input type="text" name="pwm" value="<?=$cfg['pwm']?>" placeholder="Click DETECT"><input type="button" value="Detect" onclick="detectFanLow();" id="pwm" style="margin-top:0">
|
||||
|
||||
Low temperature threshold (°<?=$display['unit']?>):
|
||||
: <input type="number" min="0" max="300" name="low" value="<?=temp_val($cfg['low'])?>" class="narrow">
|
||||
|
||||
High temperature threshold (°<?=$display['unit']?>):
|
||||
: <input type="number" min="0" max="300" name="high" value="<?=temp_val($cfg['high'])?>" class="narrow">
|
||||
|
||||
Refresh interval (minutes):
|
||||
: <input type="text" name="interval" value="<?=$cfg['interval']?>" class="narrow">
|
||||
|
||||
<input type="submit" name="#default" value="Default">
|
||||
: <input type="submit" name="#apply" value="Apply"><input type="button" value="Done" onclick="done()">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function detectFan() {
|
||||
var pwm = $("select[name=controller] option:selected").val();
|
||||
if (pwm) {
|
||||
$("input[name=fan]").val('Please wait...');
|
||||
$("#fan").val('Detecting ...');
|
||||
$.get('/plugins/<?=$plugin;?>/include/SystemFan.php',{op:'detect', pwm:pwm},function(data) {
|
||||
$("input[name=fan]").val(data);
|
||||
$("#fan").val('Detect');
|
||||
});
|
||||
}
|
||||
}
|
||||
function detectFanLow() {
|
||||
var pwm = $("select[name=controller] option:selected").val();
|
||||
var fan = $("input[name=fan]").val();
|
||||
if (pwm && fan) {
|
||||
$("input[name=pwm]").val('Please wait...');
|
||||
$("#pwm").val('Detecting ...');
|
||||
$.get('/plugins/<?=$plugin;?>/include/SystemFan.php',{op:'pwm',pwm:pwm,fan:fan},function(data) {
|
||||
$("input[name=pwm]").val(data);
|
||||
$("#pwm").val('Detect');
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
//showStatus('<?=$sName?>');
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user