|
|
@@ -114,7 +114,7 @@ static int icarus_open(const char *devpath)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, volatile unsigned long *wr)
|
|
|
+static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, volatile unsigned long *wr, int read_count)
|
|
|
{
|
|
|
ssize_t ret = 0;
|
|
|
int rc = 0;
|
|
|
@@ -149,7 +149,7 @@ static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, volatile unsig
|
|
|
rc++;
|
|
|
if (*wr)
|
|
|
return 1;
|
|
|
- if (rc == ICARUS_READ_FAULT_COUNT) {
|
|
|
+ if (rc >= read_count) {
|
|
|
if (epollfd != -1)
|
|
|
close(epollfd);
|
|
|
applog(LOG_DEBUG,
|
|
|
@@ -182,6 +182,8 @@ static bool icarus_detect_one(const char *devpath)
|
|
|
int fd;
|
|
|
|
|
|
// Block 171874 nonce = (0xa2870100) = 0x000187a2
|
|
|
+ // N.B. golden_ob MUST take less time to calculate
|
|
|
+ // than the timeout set in icarus_open()
|
|
|
// This one takes ~0.53ms on Rev3 Icarus
|
|
|
const char golden_ob[] =
|
|
|
"4679ba4ec99876bf4bfe086082b40025"
|
|
|
@@ -208,7 +210,7 @@ static bool icarus_detect_one(const char *devpath)
|
|
|
|
|
|
memset(nonce_bin, 0, sizeof(nonce_bin));
|
|
|
volatile unsigned long wr = 0;
|
|
|
- icarus_gets(nonce_bin, sizeof(nonce_bin), fd, &wr);
|
|
|
+ icarus_gets(nonce_bin, sizeof(nonce_bin), fd, &wr, 1);
|
|
|
|
|
|
icarus_close(fd);
|
|
|
|
|
|
@@ -323,7 +325,8 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|
|
|
|
|
/* Icarus will return 8 bytes nonces or nothing */
|
|
|
memset(nonce_bin, 0, sizeof(nonce_bin));
|
|
|
- ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd, wr);
|
|
|
+ ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd, wr,
|
|
|
+ ICARUS_READ_FAULT_COUNT);
|
|
|
|
|
|
gettimeofday(&tv_end, NULL);
|
|
|
timeval_subtract(&diff, &tv_end, &tv_start);
|