Browse Source

Check for DBC_TEMP capability before trying to read temperature

Luke Dashjr 12 years ago
parent
commit
393c17a256
1 changed files with 8 additions and 2 deletions
  1. 8 2
      driver-drillbit.c

+ 8 - 2
driver-drillbit.c

@@ -46,6 +46,7 @@ struct drillbit_board {
 	unsigned ext_clock_freq;
 	unsigned ext_clock_freq;
 	bool need_reinit;
 	bool need_reinit;
 	bool trigger_identify;
 	bool trigger_identify;
+	uint16_t caps;
 };
 };
 
 
 static
 static
@@ -139,7 +140,7 @@ err:
 		.deven = DEV_ENABLED,
 		.deven = DEV_ENABLED,
 		.procs = chips,
 		.procs = chips,
 		.threads = 1,
 		.threads = 1,
-		//.device_data = ,
+		.device_data = (void*)(intptr_t)caps,
 	};
 	};
 	return add_cgpu(cgpu);
 	return add_cgpu(cgpu);
 }
 }
@@ -257,14 +258,15 @@ bool drillbit_init(struct thr_info * const master_thr)
 	
 	
 	dev->device_fd = -1;
 	dev->device_fd = -1;
 	struct drillbit_board * const board = malloc(sizeof(*board));
 	struct drillbit_board * const board = malloc(sizeof(*board));
-	dev->device_data = board;
 	*board = (struct drillbit_board){
 	*board = (struct drillbit_board){
 		.core_voltage_cfg = DBV_850mV,
 		.core_voltage_cfg = DBV_850mV,
 		.clock_level = 40,
 		.clock_level = 40,
 		.clock_div2 = false,
 		.clock_div2 = false,
 		.use_ext_clock = false,
 		.use_ext_clock = false,
 		.ext_clock_freq = 200,
 		.ext_clock_freq = 200,
+		.caps = (intptr_t)dev->device_data,
 	};
 	};
+	dev->device_data = board;
 	
 	
 	drillbit_reconfigure(dev, false);
 	drillbit_reconfigure(dev, false);
 	
 	
@@ -509,6 +511,10 @@ bool drillbit_get_stats(struct cgpu_info * const dev)
 	if (dev != dev->device)
 	if (dev != dev->device)
 		return true;
 		return true;
 	
 	
+	struct drillbit_board * const board = dev->device_data;
+	if (!(board->caps & DBC_TEMP))
+		return true;
+	
 	const int fd = dev->device_fd;
 	const int fd = dev->device_fd;
 	if (fd == -1)
 	if (fd == -1)
 		return false;
 		return false;