Bugfix: Don't declare devices SICK if they're just busy initializing This mainly applies to ModMiner since it takes 4-5 minutes to upload the bitstream
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
diff --git a/api.c b/api.c
index 06a10b6..ee0d875 100644
--- a/api.c
+++ b/api.c
@@ -170,6 +170,7 @@ static const char *APIVERSION = "1.14";
static const char *DEAD = "Dead";
static const char *SICK = "Sick";
static const char *NOSTART = "NoStart";
+static const char *INIT = "Initializing";
static const char *DISABLED = "Disabled";
static const char *ALIVE = "Alive";
static const char *REJECTING = "Rejecting";
@@ -1262,6 +1263,8 @@ static void gpustatus(int gpu, bool isjson)
status = (char *)SICK;
else if (cgpu->status == LIFE_NOSTART)
status = (char *)NOSTART;
+ else if (cgpu->status == LIFE_INIT)
+ status = (char *)INIT;
else
status = (char *)ALIVE;
@@ -1361,6 +1364,8 @@ static void pgastatus(int pga, bool isjson)
status = (char *)SICK;
else if (cgpu->status == LIFE_NOSTART)
status = (char *)NOSTART;
+ else if (cgpu->status == LIFE_INIT)
+ status = (char *)INIT;
else
status = (char *)ALIVE;
diff --git a/cgminer.c b/cgminer.c
index 509e353..5a8169d 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4594,6 +4594,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
dev_count_dead = (cgpu->low_count > WATCHDOG_DEAD_COUNT);
if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME) && dev_count_well) {
+ if (cgpu->status != LIFE_INIT)
applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str);
cgpu->status = LIFE_WELL;
cgpu->device_last_well = time(NULL);
@@ -5440,6 +5441,7 @@ begin_bench:
struct cgpu_info *cgpu = devices[i];
cgpu->thr = malloc(sizeof(*cgpu->thr) * (cgpu->threads+1));
cgpu->thr[cgpu->threads] = NULL;
+ cgpu->status = LIFE_INIT;
for (j = 0; j < cgpu->threads; ++j, ++k) {
thr = &thr_info[k];
diff --git a/driver-opencl.c b/driver-opencl.c
index 10b20a4..4eef69c 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -639,6 +639,7 @@ retry:
case LIFE_DEAD:
wlog("DEAD reported in %s", checkin);
break;
+ case LIFE_INIT:
case LIFE_NOSTART:
wlog("Never started");
break;
diff --git a/miner.h b/miner.h
index a77ebae..8e268ca 100644
--- a/miner.h
+++ b/miner.h
@@ -163,7 +163,8 @@ enum alive {
LIFE_WELL,
LIFE_SICK,
LIFE_DEAD,
- LIFE_NOSTART
+ LIFE_NOSTART,
+ LIFE_INIT,
};