Created
July 4, 2012 19:16
-
-
Save midnightmagic/3049053 to your computer and use it in GitHub Desktop.
kanoi's old commit that fixed icarus DOA for me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit f4d2863dd674f73f23012e56ed59f0013913431d | |
Author: Kano <[email protected]> | |
Date: Fri Mar 30 18:54:14 2012 +1100 | |
icarus.c reduce stale by aborting work on LP | |
diff --git a/configure.ac b/configure.ac | |
index bdef687..7e18d95 100644 | |
--- a/configure.ac | |
+++ b/configure.ac | |
@@ -2,7 +2,7 @@ | |
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## | |
m4_define([v_maj], [2]) | |
m4_define([v_min], [3]) | |
-m4_define([v_mic], [1]) | |
+m4_define([v_mic], [1q]) | |
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## | |
m4_define([v_ver], [v_maj.v_min.v_mic]) | |
m4_define([lt_rev], m4_eval(v_maj + v_min)) | |
diff --git a/icarus.c b/icarus.c | |
index 276cd8c..7ee4452 100644 | |
--- a/icarus.c | |
+++ b/icarus.c | |
@@ -50,7 +50,7 @@ | |
#include "elist.h" | |
#include "miner.h" | |
-#define ICARUS_READ_FAULT_COUNT (8) | |
+#define ICARUS_READ_FAULT_COUNT (80) | |
struct device_api icarus_api; | |
@@ -87,7 +87,7 @@ static int icarus_open(const char *devpath) | |
ISTRIP | INLCR | IGNCR | ICRNL | IXON); | |
my_termios.c_oflag &= ~OPOST; | |
my_termios.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); | |
- my_termios.c_cc[VTIME] = 10; /* block 1 second */ | |
+ my_termios.c_cc[VTIME] = 1; /* block 0.1 second */ | |
my_termios.c_cc[VMIN] = 0; | |
tcsetattr(serialfd, TCSANOW, &my_termios); | |
@@ -101,14 +101,15 @@ static int icarus_open(const char *devpath) | |
if (unlikely(hSerial == INVALID_HANDLE_VALUE)) | |
return -1; | |
- COMMTIMEOUTS cto = {1000, 0, 1000, 0, 1000}; | |
+ // block 0.1 second | |
+ COMMTIMEOUTS cto = {100, 0, 100, 0, 100}; | |
SetCommTimeouts(hSerial, &cto); | |
return _open_osfhandle((LONG)hSerial, 0); | |
#endif | |
} | |
-static int icarus_gets(unsigned char *buf, size_t bufLen, int fd) | |
+static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, int thr_id) | |
{ | |
ssize_t ret = 0; | |
int rc = 0; | |
@@ -124,7 +125,14 @@ static int icarus_gets(unsigned char *buf, size_t bufLen, int fd) | |
rc++; | |
if (rc == ICARUS_READ_FAULT_COUNT) { | |
applog(LOG_DEBUG, | |
- "Icarus Read: No data in %d seconds", rc); | |
+ "Icarus Read: No data in %.2f seconds", (float)(rc/10.0f)); | |
+ return 1; | |
+ } | |
+ | |
+ if (thr_id >= 0 && work_restart[thr_id].restart) { | |
+// TODO: change this to DEBUG | |
+ applog(LOG_NOTICE, | |
+ "Icarus Read: Work restart at %.2f seconds", (float)(rc/10.0f)); | |
return 1; | |
} | |
} | |
@@ -172,7 +180,7 @@ static bool icarus_detect_one(const char *devpath) | |
icarus_write(fd, ob_bin, sizeof(ob_bin)); | |
memset(nonce_bin, 0, sizeof(nonce_bin)); | |
- icarus_gets(nonce_bin, sizeof(nonce_bin), fd); | |
+ icarus_gets(nonce_bin, sizeof(nonce_bin), fd, -1); | |
icarus_close(fd); | |
@@ -244,6 +252,7 @@ static bool icarus_prepare(struct thr_info *thr) | |
static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work, | |
__maybe_unused uint64_t max_nonce) | |
{ | |
+ const int thr_id = thr->id; | |
struct cgpu_info *icarus; | |
int fd; | |
int ret; | |
@@ -279,7 +288,7 @@ 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); | |
+ ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd, thr_id); | |
nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin)); | |
if (nonce_hex) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment