Browse Source

Bugfix: cairnsmore: Correct settings for autodetected devices

Luke Dashjr 13 years ago
parent
commit
c052937d11
2 changed files with 10 additions and 8 deletions
  1. 1 0
      driver-cairnsmore.c
  2. 9 8
      driver-icarus.c

+ 1 - 0
driver-cairnsmore.c

@@ -26,6 +26,7 @@ static bool cairnsmore_detect_one(const char *devpath)
 	info->work_division = 2;
 	info->fpga_count = 2;
 	info->quirk_reopen = false;
+	info->Hs = CAIRNSMORE1_HASH_TIME;
 
 	if (!icarus_detect_custom(devpath, &cairnsmore_api, info)) {
 		free(info);

+ 9 - 8
driver-icarus.c

@@ -321,17 +321,14 @@ static void set_timing_mode(int this_option_offset, struct cgpu_info *icarus)
 		buf[max] = '\0';
 	}
 
-	info->Hs = 0;
 	info->read_count = 0;
 
 	if (strcasecmp(buf, MODE_SHORT_STR) == 0) {
-		info->Hs = ICARUS_REV3_HASH_TIME;
 		info->read_count = ICARUS_READ_COUNT_TIMING;
 
 		info->timing_mode = MODE_SHORT;
 		info->do_icarus_timing = true;
 	} else if (strcasecmp(buf, MODE_LONG_STR) == 0) {
-		info->Hs = ICARUS_REV3_HASH_TIME;
 		info->read_count = ICARUS_READ_COUNT_TIMING;
 
 		info->timing_mode = MODE_LONG;
@@ -354,19 +351,22 @@ static void set_timing_mode(int this_option_offset, struct cgpu_info *icarus)
 	} else {
 		// Anything else in buf just uses DEFAULT mode
 
-		info->Hs = ICARUS_REV3_HASH_TIME;
 		info->fullnonce = info->Hs * (((double)0xffffffff) + 1);
 
 		if ((eq = strchr(buf, '=')) != NULL)
 			info->read_count = atoi(eq+1);
 
-		if (info->read_count < 1)
-			info->read_count = ICARUS_READ_COUNT_TIMING;
+		if (icarus->api == &icarus_api) {
+			info->do_default_detection = 0x10;
+			if (info->read_count < 1)
+				info->read_count = ICARUS_READ_COUNT_TIMING;
+		} else {
+			if (info->read_count < 1)
+				info->read_count = (int)(info->fullnonce * TIME_FACTOR) - 1;
+		}
 
 		info->timing_mode = MODE_DEFAULT;
 		info->do_icarus_timing = false;
-		if (icarus->api == &icarus_api)
-			info->do_default_detection = 0x10;
 	}
 
 	info->min_data_count = MIN_DATA_COUNT;
@@ -612,6 +612,7 @@ static bool icarus_detect_one(const char *devpath)
 	info->work_division = 2;
 	info->fpga_count = 2;
 	info->quirk_reopen = 1;
+	info->Hs = ICARUS_REV3_HASH_TIME;
 
 	if (!icarus_detect_custom(devpath, &icarus_api, info)) {
 		free(info);