Set icarus device fail time to be dependent on device speed to avoid falsely detecting failure on slower AMU devices.
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 46 47 48 49 50 51 52 53 54 55 56 57
diff --git a/driver-icarus.c b/driver-icarus.c
index a757cf4..94acad0 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -199,6 +199,8 @@ struct ICARUS_INFO {
int read_time;
// ms limit for (short=/long=) read_time
int read_time_limit;
+ // How long without hashes is considered a failed device
+ int fail_time;
enum timing_mode timing_mode;
bool do_icarus_timing;
@@ -527,7 +529,7 @@ static void set_timing_mode(int this_option_offset, struct cgpu_info *icarus)
{
struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data);
enum sub_ident ident;
- double Hs;
+ double Hs, fail_time;
char buf[BUFSIZ+1];
char *ptr, *comma, *eq;
size_t max;
@@ -664,6 +666,13 @@ static void set_timing_mode(int this_option_offset, struct cgpu_info *icarus)
icarus->drv->name, icarus->cgminer_id,
timing_mode_str(info->timing_mode),
info->read_time, info->read_time_limit, info->Hs);
+
+ /* Set the time to detect a dead device to 10 nonce ranges or 1 minute,
+ * whichever is larger. */
+ fail_time = info->Hs * 0xffffffffull * 10;
+ if (fail_time < 60)
+ fail_time = 60;
+ info->fail_time = fail_time;
}
static uint32_t mask(int work_division)
@@ -1276,16 +1285,16 @@ 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 (unlikely(last_getwork - icarus->last_device_valid_work > info->fail_time)) {
if (info->failing) {
- if (last_getwork - icarus->last_device_valid_work > 120) {
+ if (last_getwork - icarus->last_device_valid_work > info->fail_time + 60) {
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);
+ applog(LOG_WARNING, "%s %d: No valid hashes for over %d secs, attempting to reset",
+ icarus->drv->name, icarus->device_id, info->fail_time);
usb_reset(icarus);
info->failing = true;
}