Browse Source

Adjust identify_device API to return a bool whether supported or not, for runtime capability detection

Luke Dashjr 13 years ago
parent
commit
eb340117cd
3 changed files with 6 additions and 7 deletions
  1. 3 5
      api.c
  2. 2 1
      driver-bitforce.c
  3. 1 1
      miner.h

+ 3 - 5
api.c

@@ -1699,12 +1699,10 @@ static void pgaidentify(__maybe_unused SOCKETTYPE c, char *param, bool isjson, _
 	struct cgpu_info *cgpu = devices[dev];
 	struct device_api *api = cgpu->api;
 
-	if (!api->identify_device)
-		strcpy(io_buffer, message(MSG_PGANOID, id, NULL, isjson));
-	else {
-		api->identify_device(cgpu);
+	if (api->identify_device && api->identify_device(cgpu))
 		strcpy(io_buffer, message(MSG_PGAIDENT, id, NULL, isjson));
-	}
+	else
+		strcpy(io_buffer, message(MSG_PGANOID, id, NULL, isjson));
 }
 #endif
 

+ 2 - 1
driver-bitforce.c

@@ -600,9 +600,10 @@ static bool bitforce_get_stats(struct cgpu_info *bitforce)
 	return bitforce_get_temp(bitforce);
 }
 
-static void bitforce_identify(struct cgpu_info *bitforce)
+static bool bitforce_identify(struct cgpu_info *bitforce)
 {
 	bitforce->flash_led = true;
+	return true;
 }
 
 static bool bitforce_thread_init(struct thr_info *thr)

+ 1 - 1
miner.h

@@ -278,7 +278,7 @@ struct device_api {
 	struct api_data* (*get_api_extra_device_status)(struct cgpu_info*);
 	struct api_data *(*get_api_stats)(struct cgpu_info*);
 	bool (*get_stats)(struct cgpu_info*);
-	void (*identify_device)(struct cgpu_info*); // e.g. to flash a led
+	bool (*identify_device)(struct cgpu_info*);  // e.g. to flash a led
 
 	// Thread-specific functions
 	bool (*thread_prepare)(struct thr_info*);