If you SSH into the pi using Xming and Putty you can navigate to /var/www, open 'leaflet' or any other 'notepad' kind of software and paste the following code:
function cg_status() {
system("sudo ps -U root | grep -c cgminer > php.log",$ret_val);
$file = fopen("./php.log","r");
$read = fgets($file);
if($read != 0)
$cg_status = "run";
else
$cg_status = "stop";
return $cg_status;
}
function cg_stop() {
system("sudo pkill cgminer > php.log",$ret_val);
}
function cg_start($pool1, $id1, $pwd1, $pool2, $id2, $pwd2, $pool3, $id3, $pwd3, $speed1, $speed2, $speed3, $speed4, $speed5, $speed6, $diff) {
cg_stop();
sleep(1);
$cmd = "sudo ./cgminer -o ".$pool1." -u ".$id1." -p ".$pwd1." -o ".$pool2." -u ".$id2." -p ".$pwd2." -o ".$pool3." -u ".$id3." -p ".$pwd3." --A1Pll1 ".$speed1." --A1Pll2 ".$speed2." --A1Pll3 ".$speed3." --A1Pll4 ".$speed4." --A1Pll5 ".$speed5." --A1Pll6 ".$speed6." --diff ".$diff." --api-listen --api-network --cs 8 --stmcu 0 --hwreset --no-submit-stale --lowmem > cgminer.log &";
$file = fopen("./run.sh","w");
fputs($file, "#!/bin/bash\n");
fputs($file, $cmd."\n");
fclose($file);
system($cmd,$ret_val);
}
function cg_log() {
$file = fopen("./cgminer.log","r");
while(!feof($file)){
$read .= fgets($file);
}
fclose($file);
$pattern_hashmeter = '/\(5s\)[^\r]+/';
preg_match_all($pattern_hashmeter, $read, $matches_hashmeter);
$cg_log .= $matches_hashmeter[0][count($matches_hashmeter[0])-2];
return $cg_log;
}
if (isset($_POST["ip"]) && isset($_POST["netmask"]) && isset($_POST["gateway"]) && isset($_POST["dns"])){
$file = fopen("/etc/network/interfaces","w");
fputs($file, "auto lo \n");
fputs($file, "iface lo inet loopback \n");
fputs($file, "iface eth0 inet static \n");
fputs($file, "address ".$_POST["ip"]."\n");
fputs($file, "netmask ".$_POST["netmask"]."\n");
fputs($file, "gateway ".$_POST["gateway"]."\n");
fclose($file);
$file = fopen("/etc/resolv.conf","w");
fputs($file, "nameserver ".$_POST["dns"]."\n");
fclose($file);
$file = fopen("./ip.log","w");
fputs($file, $_POST["ip"]."\n");
fputs($file, $_POST["netmask"]."\n");
fputs($file, $_POST["gateway"]."\n");
fputs($file, $_POST["dns"]."\n");
fclose($file);
system("sudo reboot > php.log",$ret_val);
}
if (isset($_POST["control"]))
{
if($_POST["control"] == "stop"){
cg_stop();
$cg_status = "stop";
}
else{
if (isset($_POST["pool1"]) && isset($_POST["id1"]) && isset($_POST["pwd1"])){
$file = fopen("./user.log","w");
fputs($file, $_POST["pool1"]."\n");
fputs($file, $_POST["id1"]."\n");
fputs($file, $_POST["pwd1"]."\n");
fputs($file, $_POST["pool2"]."\n");
fputs($file, $_POST["id2"]."\n");
fputs($file, $_POST["pwd2"]."\n");
fputs($file, $_POST["pool3"]."\n");
fputs($file, $_POST["id3"]."\n");
fputs($file, $_POST["pwd3"]."\n");
fputs($file, $_POST["pool1_2"]."\n");
fputs($file, $_POST["id1_2"]."\n");
fputs($file, $_POST["pwd1_2"]."\n");
fputs($file, $_POST["pool2_2"]."\n");
fputs($file, $_POST["id2_2"]."\n");
fputs($file, $_POST["pwd2_2"]."\n");
fputs($file, $_POST["pool3_2"]."\n");
fputs($file, $_POST["id3_2"]."\n");
fputs($file, $_POST["pwd3_2"]."\n");
fputs($file, $_POST["group"]."\n");
fputs($file, $_POST["speed1"]."\n");
fputs($file, $_POST["speed2"]."\n");
fputs($file, $_POST["speed3"]."\n");
fputs($file, $_POST["speed4"]."\n");
fputs($file, $_POST["speed5"]."\n");
fputs($file, $_POST["speed6"]."\n");
fputs($file, $_POST["diff"]."\n");
fputs($file, $_POST["starttype"]."\n");
fclose($file);
if ($_POST["group"]==1){
cg_start($_POST["pool1"], $_POST["id1"], $_POST["pwd1"],
$_POST["pool2"], $_POST["id2"], $_POST["pwd2"],
$_POST["pool3"], $_POST["id3"], $_POST["pwd3"],
$_POST["speed1"], $_POST["speed2"], $_POST["speed3"], $_POST["speed4"], $_POST["speed5"], $_POST["speed6"],
$_POST["diff"]);
}
else{
cg_start($_POST["pool1_2"], $_POST["id1_2"], $_POST["pwd1_2"],
$_POST["pool2_2"], $_POST["id2_2"], $_POST["pwd2_2"],
$_POST["pool3_2"], $_POST["id3_2"], $_POST["pwd3_2"],
$_POST["speed1"], $_POST["speed2"], $_POST["speed3"], $_POST["speed4"], $_POST["speed5"], $_POST["speed6"],
$_POST["diff"]);
}
$cg_status = "run";
}
else
{
$cg_status = "stop";
}
}
}
else
{
$cg_status = cg_status();
}
$file = fopen("./user.log","r");
$read = fgets($file);
$pool1 = $read;
$read = fgets($file);
$id1 = $read;
$read = fgets($file);
$pwd1 = $read;
$read = fgets($file);
$pool2 = $read;
$read = fgets($file);
$id2 = $read;
$read = fgets($file);
$pwd2 = $read;
$read = fgets($file);
$pool3 = $read;
$read = fgets($file);
$id3 = $read;
$read = fgets($file);
$pwd3 = $read;
$read = fgets($file);
$pool1_2 = $read;
$read = fgets($file);
$id1_2 = $read;
$read = fgets($file);
$pwd1_2 = $read;
$read = fgets($file);
$pool2_2 = $read;
$read = fgets($file);
$id2_2 = $read;
$read = fgets($file);
$pwd2_2 = $read;
$read = fgets($file);
$pool3_2 = $read;
$read = fgets($file);
$id3_2 = $read;
$read = fgets($file);
$pwd3_2 = $read;
$read = fgets($file);
$group = $read;
$read = fgets($file);
$speed1 = $read;
$read = fgets($file);
$speed2 = $read;
$read = fgets($file);
$speed3 = $read;
$read = fgets($file);
$speed4 = $read;
$read = fgets($file);
$speed5 = $read;
$read = fgets($file);
$speed6 = $read;
$read = fgets($file);
$diff = $read;
$read = fgets($file);
$starttype = $read;
fclose($file);
$file = fopen("./ip.log","r");
$read = fgets($file);
$ip = $read;
$read = fgets($file);
$netmask = $read;
$read = fgets($file);
$gateway = $read;
$read = fgets($file);
$dns = $read;
fclose($file);
if ($cg_status=="run")
$cg_log = cg_log();
else
$cg_log = "";
if ($cg_status=="run")
$cg_status_color = "green";
else
$cg_status_color = "red";
if ($cg_status=="run")
$cg_status_info = "RUN";
else
$cg_status_info = "STOP";
$cg_button_info = "CGMINER SETTING CONFIRM";
//if ($cg_status=="run"){
// $cg_radio_start = '';
// $cg_radio_stop = 'checked';
//}
//else{
$cg_radio_start = 'checked';
$cg_radio_stop = '';
//}
if ($group==1){
$cg_radio_group1 = 'checked';
$cg_radio_group2 = '';
}
else{
$cg_radio_group1 = '';
$cg_radio_group2 = 'checked';
}
$ip_button_info = "NETWORK SETTING CONFIRM";
switch($speed1)
{
case 1330: $cg_option_speed1_1330 = 'selected = \"selected\"';break;
case 1320: $cg_option_speed1_1320 = 'selected = \"selected\"';break;
case 1310: $cg_option_speed1_1310 = 'selected = \"selected\"';break;
case 1300: $cg_option_speed1_1300 = 'selected = \"selected\"';break;
case 1290: $cg_option_speed1_1290 = 'selected = \"selected\"';break;
case 1280: $cg_option_speed1_1280 = 'selected = \"selected\"';break;
default: $cg_option_speed1_1280 = 'selected = \"selected\"';
}
switch($speed2)
{
case 1330: $cg_option_speed2_1330 = 'selected = \"selected\"';break;
case 1320: $cg_option_speed2_1320 = 'selected = \"selected\"';break;
case 1310: $cg_option_speed2_1310 = 'selected = \"selected\"';break;
case 1300: $cg_option_speed2_1300 = 'selected = \"selected\"';break;
case 1290: $cg_option_speed2_1290 = 'selected = \"selected\"';break;
case 1280: $cg_option_speed2_1280 = 'selected = \"selected\"';break;
default: $cg_option_speed2_1280 = 'selected = \"selected\"';
}
switch($speed3)
{
case 1330: $cg_option_speed3_1330 = 'selected = \"selected\"';break;
case 1320: $cg_option_speed3_1320 = 'selected = \"selected\"';break;
case 1310: $cg_option_speed3_1310 = 'selected = \"selected\"';break;
case 1300: $cg_option_speed3_1300 = 'selected = \"selected\"';break;
case 1290: $cg_option_speed3_1290 = 'selected = \"selected\"';break;
case 1280: $cg_option_speed3_1280 = 'selected = \"selected\"';break;
default: $cg_option_speed3_1280 = 'selected = \"selected\"';
}
switch($speed4)
{
case 1330: $cg_option_speed4_1330 = 'selected = \"selected\"';break;
case 1320: $cg_option_speed4_1320 = 'selected = \"selected\"';break;
case 1310: $cg_option_speed4_1310 = 'selected = \"selected\"';break;
case 1300: $cg_option_speed4_1300 = 'selected = \"selected\"';break;
case 1290: $cg_option_speed4_1290 = 'selected = \"selected\"';break;
case 1280: $cg_option_speed4_1280 = 'selected = \"selected\"';break;
default: $cg_option_speed4_1280 = 'selected = \"selected\"';
}
switch($speed5)
{
case 1330: $cg_option_speed5_1330 = 'selected = \"selected\"';break;
case 1320: $cg_option_speed5_1320 = 'selected = \"selected\"';break;
case 1310: $cg_option_speed5_1310 = 'selected = \"selected\"';break;
case 1300: $cg_option_speed5_1300 = 'selected = \"selected\"';break;
case 1290: $cg_option_speed5_1290 = 'selected = \"selected\"';break;
case 1280: $cg_option_speed5_1280 = 'selected = \"selected\"';break;
default: $cg_option_speed5_1280 = 'selected = \"selected\"';
}
switch($speed6)
{
case 1330: $cg_option_speed6_1330 = 'selected = \"selected\"';break;
case 1320: $cg_option_speed6_1320 = 'selected = \"selected\"';break;
case 1310: $cg_option_speed6_1310 = 'selected = \"selected\"';break;
case 1300: $cg_option_speed6_1300 = 'selected = \"selected\"';break;
case 1290: $cg_option_speed6_1290 = 'selected = \"selected\"';break;
case 1280: $cg_option_speed6_1280 = 'selected = \"selected\"';break;
default: $cg_option_speed6_1280 = 'selected = \"selected\"';
}
switch($diff)
{
case 11 : $cg_option_diff_1024 = 'selected = \"selected\"';break;
case 10 : $cg_option_diff_512 = 'selected = \"selected\"';break;
case 9 : $cg_option_diff_256 = 'selected = \"selected\"';break;
case 8 : $cg_option_diff_128 = 'selected = \"selected\"';break;
case 7 : $cg_option_diff_64 = 'selected = \"selected\"';break;
case 6 : $cg_option_diff_32 = 'selected = \"selected\"';break;
case 5 : $cg_option_diff_16 = 'selected = \"selected\"';break;
default : $cg_option_diff_128 = 'selected = \"selected\"';
}
if($starttype==1){
$cg_option_starttype_webstart = '';
$cg_option_starttype_autostart = 'selected = \"selected\"';
$file = fopen("/etc/rc.local","w");
fputs($file, "#!/bin/sh -e \n");
fputs($file, "sleep 30 \n");
fputs($file, "cd /var/www \n");
fputs($file, "./run.sh \n");
fputs($file, "exit 0 \n");
fclose($file);
}
else{
$cg_option_starttype_webstart = 'selected = \"selected\"';
$cg_option_starttype_autostart = '';
$file = fopen("/etc/rc.local","w");
fputs($file, "#!/bin/sh -e \n");
fputs($file, "exit 0 \n");
fclose($file);
}
?>
A2 - OC tweak version 1.0 by Emdje
echo $cg_log?>
Save that over the index.php that is in the /var/www folder.
I have tried 1340MHz which gave about 50% HW errors so now I am trying 1300, later on (right now my rig is rented), I will try a step higher (maybe even just 5MHz).
If you are happy with it you can of course donate some btc to: 1FiHCFcP4ovbV89nGhYEMWXSZsWnGUASSe