Use a bool in struct cgpu to know when a usb device has been blacklisted, avoiding blacklisting it more than once.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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;
}
/*