Merge pull request #251 from kanoi/notifycomms Add API Notify counter 'Comms Error'
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
diff --git a/API-README b/API-README
index 9c633bd..df905ef 100644
--- a/API-README
+++ b/API-README
@@ -313,6 +313,7 @@ API V1.14
Modified API commands:
'stats' - more icarus timing stats added
+ 'notify' - include new device comms error counter
The internal code for handling data was rewritten (~25% of the code)
Completely backward compatible
diff --git a/api.c b/api.c
index 2622b16..06a10b6 100644
--- a/api.c
+++ b/api.c
@@ -2419,6 +2419,9 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson, __maybe_unuse
case REASON_DEV_THERMAL_CUTOFF:
reason = REASON_DEV_THERMAL_CUTOFF_STR;
break;
+ case REASON_DEV_COMMS_ERROR:
+ reason = REASON_DEV_COMMS_ERROR_STR;
+ break;
default:
reason = REASON_UNKNOWN_STR;
break;
@@ -2440,6 +2443,7 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson, __maybe_unuse
root = api_add_int(root, "*Dev Nostart", &(cgpu->dev_nostart_count), false);
root = api_add_int(root, "*Dev Over Heat", &(cgpu->dev_over_heat_count), false);
root = api_add_int(root, "*Dev Thermal Cutoff", &(cgpu->dev_thermal_cutoff_count), false);
+ root = api_add_int(root, "*Dev Comms Error", &(cgpu->dev_comms_error_count), false);
if (isjson && (device > 0))
strcat(io_buffer, COMMA);
diff --git a/driver-bitforce.c b/driver-bitforce.c
index ba23911..cf2d6ca 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -412,8 +412,8 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
ret = 1;
applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id);
bitforce->device_last_not_well = time(NULL);
- bitforce->device_not_well_reason = REASON_DEV_NOSTART;
- bitforce->dev_nostart_count++;
+ bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR;
+ bitforce->dev_comms_error_count++;
/* empty read buffer */
biforce_clear_buffer(bitforce);
}
diff --git a/miner.h b/miner.h
index c50fa3e..d3fa209 100644
--- a/miner.h
+++ b/miner.h
@@ -272,6 +272,7 @@ enum dev_reason {
REASON_DEV_NOSTART,
REASON_DEV_OVER_HEAT,
REASON_DEV_THERMAL_CUTOFF,
+ REASON_DEV_COMMS_ERROR,
};
#define REASON_NONE "None"
@@ -283,6 +284,7 @@ enum dev_reason {
#define REASON_DEV_NOSTART_STR "Device failed to start"
#define REASON_DEV_OVER_HEAT_STR "Device over heated"
#define REASON_DEV_THERMAL_CUTOFF_STR "Device reached thermal cutoff"
+#define REASON_DEV_COMMS_ERROR_STR "Device comms error"
#define REASON_UNKNOWN_STR "Unknown reason - code bug"
#define MIN_SEC_UNSET 99999999
@@ -386,6 +388,7 @@ struct cgpu_info {
int dev_nostart_count;
int dev_over_heat_count; // It's a warning but worth knowing
int dev_thermal_cutoff_count;
+ int dev_comms_error_count;
struct cgminer_stats cgminer_stats;
};