Commit 93555e271a134dcf7af90befc8499acaf9569089

Kano 2012-09-04T01:23:32

API add device diff1 work

diff --git a/API-README b/API-README
index 1c2846a..cc8ee9e 100644
--- a/API-README
+++ b/API-README
@@ -362,6 +362,9 @@ Added API commands:
 
 Modified API commands:
  Change pool field name 'Diff1 Shares' to 'Diff1 Work'
+ 'devs' - add 'Diff1 Work' to all devices
+ 'gpu|N' - add 'Diff1 Work'
+ 'pga|N' - add 'Diff1 Work'
 
 ----------
 
diff --git a/api.c b/api.c
index affe13c..b4ec40f 100644
--- a/api.c
+++ b/api.c
@@ -1345,6 +1345,7 @@ static void gpustatus(int gpu, bool isjson)
 		root = api_add_int(root, "Last Share Pool", &last_share_pool, false);
 		root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
 		root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
+		root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
 
 		root = print_data(root, buf, isjson);
 		strcat(io_buffer, buf);
@@ -1428,6 +1429,7 @@ static void pgastatus(int pga, bool isjson)
 		root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
 		root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
 		root = api_add_freq(root, "Frequency", &frequency, false);
+		root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
 
 		root = print_data(root, buf, isjson);
 		strcat(io_buffer, buf);
@@ -1460,6 +1462,7 @@ static void cpustatus(int cpu, bool isjson)
 		root = api_add_int(root, "Last Share Pool", &last_share_pool, false);
 		root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
 		root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
+		root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
 
 		root = print_data(root, buf, isjson);
 		strcat(io_buffer, buf);
diff --git a/miner.php b/miner.php
index 9c6f694..8202cb6 100644
--- a/miner.php
+++ b/miner.php
@@ -755,8 +755,12 @@ function fmt($section, $name, $value, $when, $alldata)
 	case 'SUMMARY.Discarded':
 	case 'POOL.Discarded':
 	case 'total.Discarded':
-	case 'POOL.Diff1 Shares':
-	case 'total.Diff1 Shares':
+	case 'GPU.Diff1 Work':
+	case 'PGA.Diff1 Work':
+	case 'POOL.Diff1 Work':
+	case 'total.Diff1 Work':
+	case 'POOL.Diff1 Shares': // old name
+	case 'total.Diff1 Shares': // old name
 		$parts = explode('.', $value, 2);
 		if (count($parts) == 1)
 			$dec = '';