Commit b1be5c6d12b57a72a90ada421574b90a55a81345

Con Kolivas 2013-11-05T19:18:20

Different windows+usb combinations respond with varying levels of reliability wrt timeouts so use a nominal extra 40ms before cancelling transfers that fail to time out on their own.

diff --git a/usbutils.c b/usbutils.c
index 70063be..130331c 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -66,6 +66,10 @@
 #define KLONDIKE_TIMEOUT_MS 999
 #define ICARUS_TIMEOUT_MS 999
 #define HASHFAST_TIMEOUT_MS 999
+
+/* The safety timeout we use, cancelling async transfers on windows that fail
+ * to timeout on their own. */
+#define WIN_CALLBACK_EXTRA 40
 #else
 #define BFLSC_TIMEOUT_MS 300
 #define BITFORCE_TIMEOUT_MS 200
@@ -77,8 +81,6 @@
 #define HASHFAST_TIMEOUT_MS 200
 #endif
 
-#define USB_READ_MINPOLL 40
-
 #define USB_EPS(_intx, _epinfosx) { \
 		.interface = _intx, \
 		.ctrl_transfer = _intx, \
@@ -2424,7 +2426,7 @@ usb_bulk_transfer(struct libusb_device_handle *dev_handle, int intinfo,
 #ifdef WIN32
 	/* On windows the callback_timeout is a safety mechanism only. */
 	bulk_timeout = timeout;
-	callback_timeout += timeout + cgpu->usbdev->found->timeout;
+	callback_timeout += WIN_CALLBACK_EXTRA;
 #else
 	/* We give the transfer no timeout since we manage timeouts ourself on
 	 * non windows. */