Commit d141065446f18537fd1834746e919b0c3762f10d

Con Kolivas 2014-01-04T11:19:57

Add more checks in hashfast driver for lost devices.

diff --git a/driver-hashfast.c b/driver-hashfast.c
index 4c04643..6a92203 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -154,6 +154,9 @@ static bool hfa_get_header(struct cgpu_info *hashfast, struct hf_header *h, uint
 	char buf[512];
 	char *header;
 
+	if (unlikely(hashfast->usbinfo.nodev))
+		return false;
+
 	orig_len = len = sizeof(*h);
 
 	/* Read for up to 200ms till we find the first occurrence of HF_PREAMBLE
@@ -168,7 +171,10 @@ static bool hfa_get_header(struct cgpu_info *hashfast, struct hf_header *h, uint
 		if (cgtimer_to_ms(&ts_diff) > 200)
 			return false;
 
+		if (unlikely(hashfast->usbinfo.nodev))
+			return false;
 		ret = usb_read(hashfast, buf + ofs, len, &amount, C_HF_GETHEADER);
+
 		if (unlikely(ret && ret != LIBUSB_ERROR_TIMEOUT))
 			return false;
 		ofs += amount;
@@ -487,6 +493,9 @@ static bool hfa_get_packet(struct cgpu_info *hashfast, struct hf_header *h)
 	uint8_t hcrc;
 	bool ret;
 
+	if (unlikely(hashfast->usbinfo.nodev))
+		return false;
+
 	ret = hfa_get_header(hashfast, h, &hcrc);
 	if (unlikely(!ret))
 		goto out;