Comms error trapping Comms error will not disable the device permanently but put it in to recovery mode. Here it will attempt to be re-initialised after 60s.
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 77 78 79
diff --git a/driver-bitforce.c b/driver-bitforce.c
index a02000e..5e9d258 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -80,7 +80,6 @@ static bool bitforce_detect_one(const char *devpath)
bitforce->deven = DEV_ENABLED;
bitforce->threads = 1;
bitforce->sleep_ms = BITFORCE_SLEEP_MS;
- bitforce->kname = __FILE__;
if (likely((!memcmp(pdevbuf, ">>>ID: ", 7)) && (s = strstr(pdevbuf + 3, ">>>"))))
{
s[0] = '\0';
@@ -193,6 +192,7 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
if (unlikely(!pdevbuf[0])) {
applog(LOG_ERR, "BFL%i: Error reading (ZLX)", bitforce->device_id);
+ bitforce->temp = 0;
return false;
}
if ((!strncasecmp(pdevbuf, "TEMP", 4)) && (s = strchr(pdevbuf + 4, ':'))) {
@@ -285,14 +285,13 @@ static uint64_t bitforce_get_result(struct thr_info *thr, struct work *work)
bitforce->wait_ms += BITFORCE_CHECK_INTERVAL_MS;
}
if (bitforce->wait_ms >= BITFORCE_TIMEOUT_MS) {
- applog(LOG_ERR, "BFL%i took longer than 15s");
+ applog(LOG_ERR, "BFL%i: took longer than 15s", bitforce->device_id);
bitforce->device_last_not_well = time(NULL);
- bitforce->device_not_well_reason = REASON_THREAD_ZERO_HASH;
- bitforce->thread_zero_hash_count++;
+ bitforce->device_not_well_reason = REASON_DEV_OVER_HEAT;
+ bitforce->dev_over_heat_count++;
return 1;
} else {
/* Simple timing adjustment */
- // applog(LOG_WARNING, "BFL%i: Waited: %ums, sleep is:%ums", bitforce->device_id, bitforce->wait_ms, bitforce->sleep_ms);
if (bitforce->wait_ms > (bitforce->sleep_ms + WORK_CHECK_INTERVAL_MS))
bitforce->sleep_ms += WORK_CHECK_INTERVAL_MS;
else if (bitforce->wait_ms == bitforce->sleep_ms)
@@ -346,19 +345,29 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
{
struct cgpu_info *bitforce = thr->cgpu;
bitforce->wait_ms = 0;
-
- if (!bitforce_send_work(thr, work))
- return 0;
-
- while (bitforce->wait_ms < bitforce->sleep_ms) {
- usleep(WORK_CHECK_INTERVAL_MS*1000);
- bitforce->wait_ms += WORK_CHECK_INTERVAL_MS;
- if (work_restart[thr->id].restart) {
- applog(LOG_DEBUG, "BFL%i: Work restart, discarding after %dms", bitforce->device_id, bitforce->wait_ms);
- return 1; //we have discarded all work; equivilent to 0 hashes done.
+ uint64_t ret;
+
+ if (ret = bitforce_send_work(thr, work)) {
+ while (bitforce->wait_ms < bitforce->sleep_ms) {
+ usleep(WORK_CHECK_INTERVAL_MS*1000);
+ bitforce->wait_ms += WORK_CHECK_INTERVAL_MS;
+ if (work_restart[thr->id].restart) {
+ applog(LOG_DEBUG, "BFL%i: Work restart, discarding after %dms", bitforce->device_id, bitforce->wait_ms);
+ return 1; //we have discarded all work; equivilent to 0 hashes done.
+ }
}
+ ret = bitforce_get_result(thr, work);
+ }
+
+ if (!ret) {
+ ret = 1;
+ applog(LOG_ERR, "BFL%i: Comms error, going to recover mode", bitforce->device_id);
+ bitforce->device_last_not_well = time(NULL);
+ bitforce->device_not_well_reason = REASON_THREAD_ZERO_HASH;
+ bitforce->thread_zero_hash_count++;
+ bitforce->deven = DEV_RECOVER;
}
- return bitforce_get_result(thr, work);
+ return ret;
}
static bool bitforce_get_stats(struct cgpu_info *bitforce)