Attempt to detect nonce range support in BFL by sending work requring its support.
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
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 4b0304b..a80acb5 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -203,6 +203,26 @@ void bitforce_init(struct cgpu_info *bitforce)
bitforce->device_fd = fdDev;
bitforce->sleep_ms = BITFORCE_SLEEP_MS;
+
+ /* Look for nonce range support */
+ BFwrite(fdDev, "ZPX", 3);
+ BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
+ if (strncasecmp(pdevbuf, "ERR", 3)) {
+ unsigned char ob[70];
+ uint32_t *nonce;
+
+ memset(ob, 0, 68);
+ sprintf((char *)ob, ">>>>>>>>");
+ sprintf((char *)ob + 60, ">>>>>>>>");
+ nonce = (uint32_t *)(ob + 56);
+ *nonce = htobe32(0x7FFFFFFF);
+ BFwrite(fdDev, ob, 68);
+ BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
+ if (!strncasecmp(pdevbuf, "OK", 2)) {
+ applog(LOG_DEBUG, "BFL%i: Found nonce range support");
+ bitforce->nonce_range = true;
+ }
+ }
mutex_unlock(&bitforce->device_mutex);
}
diff --git a/miner.h b/miner.h
index d3fa209..cbca935 100644
--- a/miner.h
+++ b/miner.h
@@ -322,6 +322,7 @@ struct cgpu_info {
#ifdef USE_BITFORCE
unsigned int wait_ms;
unsigned int sleep_ms;
+ bool nonce_range;
#endif
pthread_mutex_t device_mutex;