Browse Source

API: Append Driver, Kernel, Model, and Device Path to device information

Luke Dashjr 14 years ago
parent
commit
9dad7a836f
1 changed files with 13 additions and 2 deletions
  1. 13 2
      api.c

+ 13 - 2
api.c

@@ -845,11 +845,22 @@ static void devstatus_an(char *buf, struct cgpu_info *cgpu, bool isjson)
 	}
 	}
 #endif
 #endif
 	tailsprintf(buf, isjson
 	tailsprintf(buf, isjson
-				? ",\"Last Share Pool\":%d,\"Last Share Time\":%lu,\"Total MH\":%.4f}"
+				? ",\"Last Share Pool\":%d,\"Last Share Time\":%lu,\"Total MH\":%.4f"
 				: ",Last Share Pool=%d,Last Share Time=%lu,Total MH=%.4f",
 				: ",Last Share Pool=%d,Last Share Time=%lu,Total MH=%.4f",
 			((unsigned long)(cgpu->last_share_pool_time) > 0) ? cgpu->last_share_pool : -1,
 			((unsigned long)(cgpu->last_share_pool_time) > 0) ? cgpu->last_share_pool : -1,
 			(unsigned long)(cgpu->last_share_pool_time), cgpu->total_mhashes);
 			(unsigned long)(cgpu->last_share_pool_time), cgpu->total_mhashes);
-	if (!isjson)
+
+	tailsprintf(buf, isjson ? ",\"Driver\":\"%s\"" : ",Driver=%s", cgpu->api->dname);
+	if (cgpu->kname)
+		tailsprintf(buf, isjson ? ",\"Kernel\":\"%s\"" : ",Kernel=%s", cgpu->kname);
+	if (cgpu->name)
+		tailsprintf(buf, isjson ? ",\"Model\":\"%s\"" : ",Model=%s", cgpu->name);
+	if (cgpu->device_path)
+		tailsprintf(buf, isjson ? ",\"Device Path\":\"%s\"" : ",Device Path=%s", cgpu->device_path);
+
+	if (isjson)
+		tailsprintf(buf, "}");
+	else
 		tailsprintf(buf, "%c", SEPARATOR);
 		tailsprintf(buf, "%c", SEPARATOR);
 }
 }