Browse Source

drillbit: Support identify command

Luke Dashjr 12 years ago
parent
commit
da1177e5e5
1 changed files with 19 additions and 0 deletions
  1. 19 0
      driver-drillbit.c

+ 19 - 0
driver-drillbit.c

@@ -45,6 +45,7 @@ struct drillbit_board {
 	bool use_ext_clock;
 	bool use_ext_clock;
 	unsigned ext_clock_freq;
 	unsigned ext_clock_freq;
 	bool need_reinit;
 	bool need_reinit;
+	bool trigger_identify;
 };
 };
 
 
 static
 static
@@ -428,10 +429,27 @@ void drillbit_poll(struct thr_info * const master_thr)
 			drillbit_resend_jobs(proc);
 			drillbit_resend_jobs(proc);
 		board->need_reinit = false;
 		board->need_reinit = false;
 	}
 	}
+	if (board->trigger_identify)
+	{
+		const int fd = dev->device_fd;
+		applog(LOG_DEBUG, "%s: Sending identify command", dev->dev_repr);
+		if (1 != write(fd, "L", 1))
+			applog(LOG_ERR, "%s: Error writing identify command", dev->dev_repr);
+		drillbit_check_response(dev->dev_repr, fd, dev, 'L');
+		board->trigger_identify = false;
+	}
 	
 	
 	timer_set_delay_from_now(&master_thr->tv_poll, 10000);
 	timer_set_delay_from_now(&master_thr->tv_poll, 10000);
 }
 }
 
 
+static bool drillbit_identify(struct cgpu_info * const proc)
+{
+	struct cgpu_info * const dev = proc->device;
+	struct drillbit_board * const board = dev->device_data;
+	board->trigger_identify = true;
+	return true;
+}
+
 static
 static
 bool drillbit_get_stats(struct cgpu_info * const dev)
 bool drillbit_get_stats(struct cgpu_info * const dev)
 {
 {
@@ -628,6 +646,7 @@ struct device_drv drillbit_drv = {
 	.job_process_results = drillbit_job_process_results,
 	.job_process_results = drillbit_job_process_results,
 	.poll = drillbit_poll,
 	.poll = drillbit_poll,
 	.get_stats = drillbit_get_stats,
 	.get_stats = drillbit_get_stats,
+	.identify_device = drillbit_identify,
 	
 	
 	.get_api_stats = drillbit_api_stats,
 	.get_api_stats = drillbit_api_stats,
 	.set_device = drillbit_set_device,
 	.set_device = drillbit_set_device,