MMQ allow partial work replies and count them
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 44 45 46 47 48 49 50 51
diff --git a/driver-modminer.c b/driver-modminer.c
index 1ff30b8..ab79fae 100644
--- a/driver-modminer.c
+++ b/driver-modminer.c
@@ -873,7 +873,7 @@ static uint64_t modminer_process_results(struct thr_info *thr)
char cmd[2];
uint32_t nonce;
uint32_t curr_hw_errors;
- int err, amount;
+ int err, amount, amount2;
int timeoutloop;
double timeout;
int temploop;
@@ -908,6 +908,16 @@ static uint64_t modminer_process_results(struct thr_info *thr)
}
err = usb_read(modminer, (char *)(&nonce), 4, &amount, C_GETWORKSTATUS);
+ while (err == LIBUSB_SUCCESS && amount < 4) {
+ size_t remain = 4 - amount;
+ char *pos = ((char *)(&nonce)) + amount;
+
+ state->success_more++;
+
+ err = usb_read(modminer, pos, remain, &amount2, C_GETWORKSTATUS);
+
+ amount += amount2;
+ }
mutex_unlock(modminer->modminer_mutex);
if (err < 0 || amount < 4) {
@@ -917,7 +927,7 @@ static uint64_t modminer_process_results(struct thr_info *thr)
goto tryagain;
applog(LOG_ERR, "%s%u: Error reading (get nonce) (%d:%d)",
- modminer->api->name, modminer->device_id, amount, err);
+ modminer->api->name, modminer->device_id, amount+amount2, err);
}
if (memcmp(&nonce, "\xff\xff\xff\xff", 4)) {
diff --git a/miner.h b/miner.h
index 7f5b6c8..ac8acc7 100644
--- a/miner.h
+++ b/miner.h
@@ -1033,6 +1033,7 @@ struct modminer_fpga_state {
uint32_t shares_last_hw;
uint32_t hw_errors;
uint32_t shares_to_good;
+ uint32_t success_more;
struct timeval last_changed;
struct timeval last_nonce;
struct timeval first_work;