Commit d551eba011d4959aeb779d11a1709abc771e153f

Con Kolivas 2014-01-25T00:16:15

Don't replace usb pipe errors with the pipe reset return code.

diff --git a/usbutils.c b/usbutils.c
index 88ebd07..757e7e2 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2572,20 +2572,20 @@ pipe_retry:
 	}
 
 	if (err == LIBUSB_ERROR_PIPE) {
-		int retries = 0;
+		int pipeerr, retries = 0;
 
 		do {
 			cgpu->usbinfo.last_pipe = time(NULL);
 			cgpu->usbinfo.pipe_count++;
 			applog(LOG_INFO, "%s%i: libusb pipe error, trying to clear",
 				cgpu->drv->name, cgpu->device_id);
-			err = libusb_clear_halt(dev_handle, endpoint);
+			pipeerr = libusb_clear_halt(dev_handle, endpoint);
 			applog(LOG_DEBUG, "%s%i: libusb pipe error%scleared",
 				cgpu->drv->name, cgpu->device_id, err ? " not " : " ");
 
-			if (err)
+			if (pipeerr)
 				cgpu->usbinfo.clear_fail_count++;
-		} while (err && ++retries < USB_RETRY_MAX);
+		} while (pipeerr && ++retries < USB_RETRY_MAX);
 		if (!err && ++pipe_retries < USB_RETRY_MAX)
 			goto pipe_retry;
 	}