From aefc83fe583fd38561c5b9a210ae227a3f858e12 Mon Sep 17 00:00:00 2001
From: Nate Woolls
Date: Mon, 21 Jul 2014 13:34:14 -0400
Subject: [PATCH 1/2] gc3355: Return bytes read to distinguish 0 bytes from
error
---
gc3355.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gc3355.c b/gc3355.c
index a647f7f183..c3df99d4a9 100644
--- a/gc3355.c
+++ b/gc3355.c
@@ -403,7 +403,7 @@ int gc3355_read(int fd, char *buf, size_t size)
}
if (unlikely(tries == 0))
- return -1;
+ return read;
if ((read > 0) && opt_dev_protocol)
gc3355_log_protocol(fd, buf, read, "RECV");
From ca3d7a14935940ab0f0ce8c8626107d6a411a86b Mon Sep 17 00:00:00 2001
From: Nate Woolls
Date: Mon, 21 Jul 2014 13:37:59 -0400
Subject: [PATCH 2/2] Bugfix: gridseed: Report communication errors using
dev_error()
---
driver-gridseed.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/driver-gridseed.c b/driver-gridseed.c
index c48fc862c3..5905b8e0aa 100644
--- a/driver-gridseed.c
+++ b/driver-gridseed.c
@@ -178,6 +178,7 @@ bool gridseed_prepare_work(struct thr_info __maybe_unused *thr, struct work *wor
if (sizeof(cmd) != gc3355_write(device->device_fd, cmd, sizeof(cmd)))
{
applog(LOG_ERR, "%s: Failed to send work", device->dev_repr);
+ dev_error(device, REASON_DEV_COMMS_ERROR);
return false;
}
@@ -248,6 +249,12 @@ int64_t gridseed_scanhash(struct thr_info *thr, struct work *work, int64_t __may
}
}
+ if (read == -1)
+ {
+ applog(LOG_ERR, "%s: Failed to read result", device->dev_repr);
+ dev_error(device, REASON_DEV_COMMS_ERROR);
+ }
+
gridseed_hashes_done(thr);
return 0;