Browse Source

Merge commit '67e92de' into bfgminer

Luke Dashjr 13 years ago
parent
commit
e853efe868
5 changed files with 15 additions and 4 deletions
  1. 1 0
      API-README
  2. 4 0
      api.c
  3. 2 2
      driver-bitforce.c
  4. 5 2
      miner.c
  5. 3 0
      miner.h

+ 1 - 0
API-README

@@ -314,6 +314,7 @@ API V1.14
 
 
 Modified API commands:
 Modified API commands:
  'stats' - more icarus timing stats added
  '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)
 The internal code for handling data was rewritten (~25% of the code)
 Completely backward compatible
 Completely backward compatible

+ 4 - 0
api.c

@@ -2345,6 +2345,9 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson, __maybe_unuse
 			case REASON_DEV_THERMAL_CUTOFF:
 			case REASON_DEV_THERMAL_CUTOFF:
 				reason = REASON_DEV_THERMAL_CUTOFF_STR;
 				reason = REASON_DEV_THERMAL_CUTOFF_STR;
 				break;
 				break;
+			case REASON_DEV_COMMS_ERROR:
+				reason = REASON_DEV_COMMS_ERROR_STR;
+				break;
 			default:
 			default:
 				reason = REASON_UNKNOWN_STR;
 				reason = REASON_UNKNOWN_STR;
 				break;
 				break;
@@ -2366,6 +2369,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 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 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 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))
 	if (isjson && (device > 0))
 		strcat(io_buffer, COMMA);
 		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;
 		ret = 1;
 		applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id);
 		applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id);
 		bitforce->device_last_not_well = time(NULL);
 		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 */
 		/* empty read buffer */
 		biforce_clear_buffer(bitforce);
 		biforce_clear_buffer(bitforce);
 	}
 	}

+ 5 - 2
miner.c

@@ -1428,6 +1428,8 @@ static void adj_width(int var, int *length)
 		(*length)++;
 		(*length)++;
 }
 }
 
 
+static int dev_width;
+
 static void curses_print_devstatus(int thr_id)
 static void curses_print_devstatus(int thr_id)
 {
 {
 	static int awidth = 1, rwidth = 1, hwwidth = 1, uwidth = 1;
 	static int awidth = 1, rwidth = 1, hwwidth = 1, uwidth = 1;
@@ -1439,7 +1441,7 @@ static void curses_print_devstatus(int thr_id)
 	/* Check this isn't out of the window size */
 	/* Check this isn't out of the window size */
 	if (wmove(statuswin,devcursor + cgpu->cgminer_id, 0) == ERR)
 	if (wmove(statuswin,devcursor + cgpu->cgminer_id, 0) == ERR)
 		return;
 		return;
-	wprintw(statuswin, " %s %d: ", cgpu->api->name, cgpu->device_id);
+	wprintw(statuswin, " %s %*d: ", cgpu->api->name, dev_width, cgpu->device_id);
 	if (cgpu->api->get_statline_before) {
 	if (cgpu->api->get_statline_before) {
 		logline[0] = '\0';
 		logline[0] = '\0';
 		cgpu->api->get_statline_before(logline, cgpu);
 		cgpu->api->get_statline_before(logline, cgpu);
@@ -4649,7 +4651,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
 			dev_count_sick = (cgpu->low_count > WATCHDOG_SICK_COUNT);
 			dev_count_sick = (cgpu->low_count > WATCHDOG_SICK_COUNT);
 			dev_count_dead = (cgpu->low_count > WATCHDOG_DEAD_COUNT);
 			dev_count_dead = (cgpu->low_count > WATCHDOG_DEAD_COUNT);
 
 
-			if (gpus[gpu].status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME) && dev_count_well) {
+			if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME) && dev_count_well) {
 				applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str);
 				applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str);
 				cgpu->status = LIFE_WELL;
 				cgpu->status = LIFE_WELL;
 				cgpu->device_last_well = time(NULL);
 				cgpu->device_last_well = time(NULL);
@@ -5049,6 +5051,7 @@ void enable_device(struct cgpu_info *cgpu)
 	cgpu->deven = DEV_ENABLED;
 	cgpu->deven = DEV_ENABLED;
 	devices[cgpu->cgminer_id = cgminer_id_count++] = cgpu;
 	devices[cgpu->cgminer_id = cgminer_id_count++] = cgpu;
 	mining_threads += cgpu->threads;
 	mining_threads += cgpu->threads;
+	adj_width(mining_threads, &dev_width);
 #ifdef HAVE_OPENCL
 #ifdef HAVE_OPENCL
 	if (cgpu->api == &opencl_api) {
 	if (cgpu->api == &opencl_api) {
 		gpu_threads += cgpu->threads;
 		gpu_threads += cgpu->threads;

+ 3 - 0
miner.h

@@ -270,6 +270,7 @@ enum dev_reason {
 	REASON_DEV_NOSTART,
 	REASON_DEV_NOSTART,
 	REASON_DEV_OVER_HEAT,
 	REASON_DEV_OVER_HEAT,
 	REASON_DEV_THERMAL_CUTOFF,
 	REASON_DEV_THERMAL_CUTOFF,
+	REASON_DEV_COMMS_ERROR,
 };
 };
 
 
 #define REASON_NONE			"None"
 #define REASON_NONE			"None"
@@ -281,6 +282,7 @@ enum dev_reason {
 #define REASON_DEV_NOSTART_STR		"Device failed to start"
 #define REASON_DEV_NOSTART_STR		"Device failed to start"
 #define REASON_DEV_OVER_HEAT_STR	"Device over heated"
 #define REASON_DEV_OVER_HEAT_STR	"Device over heated"
 #define REASON_DEV_THERMAL_CUTOFF_STR	"Device reached thermal cutoff"
 #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 REASON_UNKNOWN_STR		"Unknown reason - code bug"
 
 
 #define MIN_SEC_UNSET 99999999
 #define MIN_SEC_UNSET 99999999
@@ -385,6 +387,7 @@ struct cgpu_info {
 	int dev_nostart_count;
 	int dev_nostart_count;
 	int dev_over_heat_count;	// It's a warning but worth knowing
 	int dev_over_heat_count;	// It's a warning but worth knowing
 	int dev_thermal_cutoff_count;
 	int dev_thermal_cutoff_count;
+	int dev_comms_error_count;
 
 
 	struct cgminer_stats cgminer_stats;
 	struct cgminer_stats cgminer_stats;
 };
 };