Browse Source

icarus: probe_timeout setting to control how long we wait before giving up on probes

Luke Dashjr 12 years ago
parent
commit
98a960ae98
2 changed files with 12 additions and 1 deletions
  1. 11 1
      driver-icarus.c
  2. 1 0
      icarus-common.h

+ 11 - 1
driver-icarus.c

@@ -490,6 +490,7 @@ bool icarus_detect_custom(const char *devpath, struct device_drv *api, struct IC
 	
 	
 	// Set a default so that individual drivers need not specify
 	// Set a default so that individual drivers need not specify
 	// e.g. Cairnsmore
 	// e.g. Cairnsmore
+	BFGINIT(info->probe_read_count, 1);
 	if (info->read_size == 0)
 	if (info->read_size == 0)
 		info->read_size = ICARUS_DEFAULT_READ_SIZE;
 		info->read_size = ICARUS_DEFAULT_READ_SIZE;
 
 
@@ -501,7 +502,7 @@ bool icarus_detect_custom(const char *devpath, struct device_drv *api, struct IC
 	// Do not use info->read_size here, instead read exactly ICARUS_NONCE_SIZE
 	// Do not use info->read_size here, instead read exactly ICARUS_NONCE_SIZE
 	// We will then compare the bytes left in fd with info->read_size to determine
 	// We will then compare the bytes left in fd with info->read_size to determine
 	// if this is a valid device
 	// if this is a valid device
-	icarus_gets(nonce_bin, fd, &tv_finish, NULL, 1, ICARUS_NONCE_SIZE);
+	icarus_gets(nonce_bin, fd, &tv_finish, NULL, info->probe_read_count, ICARUS_NONCE_SIZE);
 	
 	
 	// How many bytes were left after reading the above nonce
 	// How many bytes were left after reading the above nonce
 	int bytes_left = icarus_excess_nonce_size(fd, info);
 	int bytes_left = icarus_excess_nonce_size(fd, info);
@@ -1246,6 +1247,14 @@ const char *icarus_set_baud(struct cgpu_info * const proc, const char * const op
 	return NULL;
 	return NULL;
 }
 }
 
 
+static
+const char *icarus_set_probe_timeout(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
+{
+	struct ICARUS_INFO * const info = proc->device_data;
+	info->probe_read_count = atof(newvalue) * 10.0 / ICARUS_READ_FAULT_DECISECONDS;
+	return NULL;
+}
+
 static
 static
 const char *icarus_set_work_division(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
 const char *icarus_set_work_division(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
 {
 {
@@ -1310,6 +1319,7 @@ const struct bfg_set_device_definition icarus_set_device_funcs[] = {
 	{"fpga_count"   , icarus_set_fpga_count   , "number of chips working on pieces"},
 	{"fpga_count"   , icarus_set_fpga_count   , "number of chips working on pieces"},
 	{"reopen"       , icarus_set_reopen       , "how often to reopen device: never, timeout, cycle, (or now for a one-shot reopen)"},
 	{"reopen"       , icarus_set_reopen       , "how often to reopen device: never, timeout, cycle, (or now for a one-shot reopen)"},
 	// NOTE: Below here, order is irrelevant
 	// NOTE: Below here, order is irrelevant
+	{"probe_timeout", icarus_set_probe_timeout},
 	{"timing"       , icarus_set_timing       , "timing of device; see README.FPGA"},
 	{"timing"       , icarus_set_timing       , "timing of device; see README.FPGA"},
 	{NULL},
 	{NULL},
 };
 };

+ 1 - 0
icarus-common.h

@@ -76,6 +76,7 @@ struct ICARUS_INFO {
 	// seconds per Hash
 	// seconds per Hash
 	double Hs;
 	double Hs;
 	int read_count;
 	int read_count;
+	int probe_read_count;
 	// ds limit for (short=/long=) read_count
 	// ds limit for (short=/long=) read_count
 	int read_count_limit;
 	int read_count_limit;