Browse Source

Merge pull request #522 from nwoolls/bug/gridseed-report-comm-errors

Bugfix: gridseed: Report communication errors using dev_error()
Luke-Jr 11 years ago
parent
commit
5f0e16370c
2 changed files with 8 additions and 1 deletions
  1. 7 0
      driver-gridseed.c
  2. 1 1
      gc3355.c

+ 7 - 0
driver-gridseed.c

@@ -182,6 +182,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)))
 	if (sizeof(cmd) != gc3355_write(device->device_fd, cmd, sizeof(cmd)))
 	{
 	{
 		applog(LOG_ERR, "%s: Failed to send work", device->dev_repr);
 		applog(LOG_ERR, "%s: Failed to send work", device->dev_repr);
+		dev_error(device, REASON_DEV_COMMS_ERROR);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -252,6 +253,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);
 	gridseed_hashes_done(thr);
 
 
 	return 0;
 	return 0;

+ 1 - 1
gc3355.c

@@ -403,7 +403,7 @@ int gc3355_read(int fd, char *buf, size_t size)
 	}
 	}
 	
 	
 	if (unlikely(tries == 0))
 	if (unlikely(tries == 0))
-		return -1;
+		return read;
 	
 	
 	if ((read > 0) && opt_dev_protocol)
 	if ((read > 0) && opt_dev_protocol)
 		gc3355_log_protocol(fd, buf, read, "RECV");
 		gc3355_log_protocol(fd, buf, read, "RECV");