Commit 38ae7093d25692c02d22f7f4cfcf46a8f36c9688

Con Kolivas 2013-10-07T17:56:57

Check for continuous IO errors on USB and consider the device inactive if more than retry max.

diff --git a/usbutils.c b/usbutils.c
index ec9b088..451f063 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2614,6 +2614,8 @@ out_unlock:
 	if (err && err != LIBUSB_ERROR_TIMEOUT && err != LIBUSB_TRANSFER_TIMED_OUT) {
 		applog(LOG_WARNING, "%s %i usb read error: %s", cgpu->drv->name, cgpu->device_id,
 		       libusb_error_name(err));
+		if (cgpu->usbinfo.continuous_ioerr_count > USB_RETRY_MAX)
+			err = LIBUSB_ERROR_OTHER;
 	}
 out_noerrmsg:
 	DEVRUNLOCK(cgpu, pstate);
@@ -2710,6 +2712,8 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
 	if (err) {
 		applog(LOG_WARNING, "%s %i usb write error: %s", cgpu->drv->name, cgpu->device_id,
 		       libusb_error_name(err));
+		if (cgpu->usbinfo.continuous_ioerr_count > USB_RETRY_MAX)
+			err = LIBUSB_ERROR_OTHER;
 	}
 out_noerrmsg:
 	DEVRUNLOCK(cgpu, pstate);