Browse Source

hashbuster: Get temperature when available

Luke Dashjr 12 years ago
parent
commit
05c3c81b71
1 changed files with 23 additions and 0 deletions
  1. 23 0
      driver-hashbuster.c

+ 23 - 0
driver-hashbuster.c

@@ -267,6 +267,27 @@ bool hashbuster_init(struct thr_info * const thr)
 	return true;
 }
 
+static
+bool hashbuster_get_stats(struct cgpu_info * const cgpu)
+{
+	struct cgpu_info *proc;
+	if (cgpu != cgpu->device)
+		return true;
+	
+	struct bitfury_device * const bitfury = cgpu->device_data;
+	struct spi_port * const spi = bitfury->spi;
+	hid_device * const h = spi->userp;
+	uint8_t buf[0x40] = {'\x04'};
+	if (!hashbuster_io(h, buf, buf))
+		return false;
+	if (buf[1])
+	{
+		for (proc = cgpu; proc; proc = proc->next_proc)
+			proc->temp = buf[1];
+	}
+	return true;
+}
+
 struct device_drv hashbuster_drv = {
 	.dname = "hashbuster",
 	.name = "HBR",
@@ -280,6 +301,8 @@ struct device_drv hashbuster_drv = {
 	.poll = bitfury_do_io,
 	.job_process_results = bitfury_job_process_results,
 	
+	.get_stats = hashbuster_get_stats,
+	
 	.get_api_extra_device_detail = bitfury_api_device_detail,
 	.get_api_extra_device_status = bitfury_api_device_status,
 	.set_device = bitfury_set_device,