Commit cfa0f6bc7bc2b786e72ebdbc3cc069a6bcb6ba43

Con Kolivas 2014-02-14T19:52:35

Use a bool in struct cgpu to know when a usb device has been blacklisted, avoiding blacklisting it more than once.

diff --git a/miner.h b/miner.h
index dc12443..f35cfe5 100644
--- a/miner.h
+++ b/miner.h
@@ -423,6 +423,8 @@ struct cgpu_info {
 	void *device_data;
 #ifdef USE_USBUTILS
 	struct cg_usb_device *usbdev;
+	struct cg_usb_info usbinfo;
+	bool blacklisted;
 #endif
 #ifdef USE_AVALON
 	struct work **works;
@@ -430,9 +432,6 @@ struct cgpu_info {
 	int queued;
 	int results;
 #endif
-#ifdef USE_USBUTILS
-	struct cg_usb_info usbinfo;
-#endif
 #ifdef USE_MODMINER
 	char fpgaid;
 	unsigned char clock;
diff --git a/usbutils.c b/usbutils.c
index 325a18a..be300d0 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -1545,9 +1545,12 @@ static void release_cgpu(struct cgpu_info *cgpu)
 
 void blacklist_cgpu(struct cgpu_info *cgpu)
 {
+	if (cgpu->blacklisted)
+		return;
 	if (__release_cgpu(cgpu))
 		cgminer_usb_unlock_bd(cgpu->drv, cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address);
 	add_in_use(cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address, true);
+	cgpu->blacklisted = true;
 }
 
 /*