Browse Source

Add API Notify counter 'Comms Error'

Kano 13 years ago
parent
commit
ff0afb94ec
4 changed files with 10 additions and 2 deletions
  1. 1 0
      API-README
  2. 4 0
      api.c
  3. 2 2
      driver-bitforce.c
  4. 3 0
      miner.h

+ 1 - 0
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

+ 4 - 0
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);

+ 2 - 2
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);
 	}

+ 3 - 0
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;
 };