Detect non-responsive icarus devices and attempt a usb reset before killing them after 2 minutes of no hashes.
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 41 42 43 44 45
diff --git a/driver-icarus.c b/driver-icarus.c
index b441078..40600f8 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -224,6 +224,8 @@ struct ICARUS_INFO {
bool flash_next_work;
int nonce_size;
+
+ bool failing;
};
#define ICARUS_MIDSTATE_SIZE 32
@@ -1251,6 +1253,21 @@ static int64_t icarus_scanwork(struct thr_info *thr)
uint32_t values;
int64_t hash_count_range;
+ if (unlikely(last_getwork - icarus->last_device_valid_work > 60)) {
+ if (info->failing) {
+ if (last_getwork - icarus->last_device_valid_work > 120) {
+ applog(LOG_ERR, "%s %d: Device failed to respond to restart",
+ icarus->drv->name, icarus->device_id);
+ return -1;
+ }
+ } else {
+ applog(LOG_WARNING, "%s %d: No valid hashes for over 1 minute, attempting to reset",
+ icarus->drv->name, icarus->device_id);
+ usb_reset(icarus);
+ info->failing = true;
+ }
+ }
+
// Device is gone
if (icarus->usbinfo.nodev)
return -1;
@@ -1454,6 +1471,9 @@ static int64_t icarus_scanwork(struct thr_info *thr)
}
out:
free_work(work);
+
+ if (hash_count > 0)
+ info->failing = false;
return hash_count;
}