api.c miner.php add a '*' to the front of all notify counters - simplifies future support of new counters
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/api.c b/api.c
index 8c86252..8a95a62 100644
--- a/api.c
+++ b/api.c
@@ -1638,8 +1638,10 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson)
break;
}
+ // ALL counters (and only counters) must start the name with a '*'
+ // Simplifies future external support for adding new counters
if (isjson)
- sprintf(buf, "%s{\"NOTIFY\":%d,\"Name\":\"%s\",\"ID\":%d,\"Last Well\":%lu,\"Last Not Well\":%lu,\"Reason Not Well\":\"%s\",\"Thread Fail Init\":%d,\"Thread Zero Hash\":%d,\"Thread Fail Queue\":%d,\"Dev Sick Idle 60s\":%d,\"Dev Dead Idle 600s\":%d,\"Dev Nostart\":%d,\"Dev Over Heat\":%d,\"Dev Thermal Cutoff\":%d}" JSON_CLOSE,
+ sprintf(buf, "%s{\"NOTIFY\":%d,\"Name\":\"%s\",\"ID\":%d,\"Last Well\":%lu,\"Last Not Well\":%lu,\"Reason Not Well\":\"%s\",\"*Thread Fail Init\":%d,\"*Thread Zero Hash\":%d,\"*Thread Fail Queue\":%d,\"*Dev Sick Idle 60s\":%d,\"*Dev Dead Idle 600s\":%d,\"*Dev Nostart\":%d,\"*Dev Over Heat\":%d,\"*Dev Thermal Cutoff\":%d}" JSON_CLOSE,
device > 0 ? "," : "", device, cgpu->api->name, cgpu->device_id,
cgpu->device_last_well, cgpu->device_last_not_well, reason,
cgpu->thread_fail_init_count, cgpu->thread_zero_hash_count,
@@ -1647,7 +1649,7 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson)
cgpu->dev_dead_idle_600_count, cgpu->dev_nostart_count,
cgpu->dev_over_heat_count, cgpu->dev_thermal_cutoff_count);
else
- sprintf(buf, "NOTIFY=%d,Name=%s,ID=%d,Last Well=%lu,Last Not Well=%lu,Reason Not Well=%s,Thread Fail Init=%d,Thread Zero Hash=%d,Thread Fail Queue=%d,Dev Sick Idle 60s=%d,Dev Dead Idle 600s=%d,Dev Nostart=%d,Dev Over Heat=%d,Dev Thermal Cutoff=%d%c",
+ sprintf(buf, "NOTIFY=%d,Name=%s,ID=%d,Last Well=%lu,Last Not Well=%lu,Reason Not Well=%s,*Thread Fail Init=%d,*Thread Zero Hash=%d,*Thread Fail Queue=%d,*Dev Sick Idle 60s=%d,*Dev Dead Idle 600s=%d,*Dev Nostart=%d,*Dev Over Heat=%d,*Dev Thermal Cutoff=%d%c",
device, cgpu->api->name, cgpu->device_id,
cgpu->device_last_well, cgpu->device_last_not_well, reason,
cgpu->thread_fail_init_count, cgpu->thread_zero_hash_count,
diff --git a/miner.php b/miner.php
index 14b249e..5cdcc7e 100644
--- a/miner.php
+++ b/miner.php
@@ -256,14 +256,8 @@ function fmt($section, $name, $value)
break;
}
- if ($section == 'NOTIFY')
- {
- $code = preg_split('/ /', $name);
- if (count($code) > 1)
- if ($code[0] == 'Thread' || $code[0] == 'Dev')
- if ($value != '0')
- $class = $errorclass;
- }
+ if ($section == 'NOTIFY' && substr($name, 0, 1) == '*' && $value != '0')
+ $class = $errorclass;
return array($ret, $class);
}