From 702dd0f86f88159ed81c2780087b76138e60f9a7 Mon Sep 17 00:00:00 2001 From: Kano Date: Tue, 6 Mar 2012 18:51:16 +1100 Subject: [PATCH] miner.php split devs output for different devices --- miner.php | 79 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/miner.php b/miner.php index d385a8ff..8f37dfcc 100644 --- a/miner.php +++ b/miner.php @@ -158,7 +158,8 @@ function fmt($section, $name, $value) switch ($section.'.'.$name) { - case 'GPU0.Last Share Time': + case 'GPU.Last Share Time': + case 'PGA.Last Share Time': return date('H:i:s', $value); break; case 'SUMMARY.Elapsed': @@ -190,11 +191,13 @@ function fmt($section, $name, $value) } } break; - case 'GPU0.Utility': + case 'GPU.Utility': + case 'PGA.Utility': case 'SUMMARY.Utility': return $value.'/m'; break; - case 'GPU0.Temperature': + case 'GPU.Temperature': + case 'PGA.Temperature': return $value.'°C'; break; } @@ -202,8 +205,37 @@ function fmt($section, $name, $value) return $value; } # +global $poolcmd; +$poolcmd = array( 'Switch to' => 'switchpool', + 'Enable' => 'enablepool', + 'Disable' => 'disablepool' ); +# +function showhead($cmd, $item, $values) +{ + global $poolcmd; + + echo ''; + + foreach ($values as $name => $value) + { + if ($name == '0') + $name = ' '; + echo "$name"; + } + + if ($cmd == 'pools') + foreach ($poolcmd as $name => $pcmd) + echo "$name"; + + echo ''; +} +# function details($cmd, $list) { + global $poolcmd; + + $dfmt = 'H:i:s j-M-Y \U\T\CP'; + $stas = array('S' => 'Success', 'W' => 'Warning', 'I' => 'Informational', 'E' => 'Error', 'F' => 'Fatal'); $tb = ''; @@ -211,7 +243,7 @@ function details($cmd, $list) echo $tb; - echo ''; + echo ''; echo $te.$tb; @@ -219,49 +251,30 @@ function details($cmd, $list) { echo ''; echo ''; + if (isset($list['STATUS']['When'])) + echo ''; $sta = $list['STATUS']['STATUS']; echo ''; echo ''; echo ''; } - echo $te.$tb; $section = ''; - $poolcmd = array( 'Switch to' => 'switchpool', - 'Enable' => 'enablepool', - 'Disable' => 'disablepool' ); - foreach ($list as $item => $values) { - if ($item != 'STATUS') - { - $section = $item; - - echo ''; - - foreach ($values as $name => $value) - { - if ($name == '0') - $name = ' '; - echo ""; - } - - if ($cmd == 'pools') - foreach ($poolcmd as $name => $pcmd) - echo ""; + if ($item == 'STATUS') + continue; - echo ''; + $sectionname = ereg_replace('[0-9]', '', $item); - break; + if ($sectionname != $section) + { + echo $te.$tb; + showhead($cmd, $item, $values); + $section = $sectionname; } - } - - foreach ($list as $item => $values) - { - if ($item == 'STATUS') - continue; echo '';
Date: '.date('H:i:s j-M-Y \U\T\CP').'
Date: '.date($dfmt).'
Computer: '.$list['STATUS']['Description'].'When: '.date($dfmt, $list['STATUS']['When']).'Status: '.$stas[$sta].'Message: '.$list['STATUS']['Msg'].'
$name$name