1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-08-26 13:52:02 +00:00

Retry up to USB_RETRY_MAX times to clear a halt condition before failing.

This commit is contained in:
Con Kolivas 2013-10-11 14:37:40 +11:00
parent 3a7a677f45
commit 6d18ce4caa

View File

@ -2310,6 +2310,9 @@ usb_bulk_transfer(struct libusb_device_handle *dev_handle, int intinfo,
usb_cmdname(cmd), *transferred, err, errn); usb_cmdname(cmd), *transferred, err, errn);
if (err == LIBUSB_ERROR_PIPE || err == LIBUSB_TRANSFER_STALL) { if (err == LIBUSB_ERROR_PIPE || err == LIBUSB_TRANSFER_STALL) {
int retries = 0;
do {
cgpu->usbinfo.last_pipe = time(NULL); cgpu->usbinfo.last_pipe = time(NULL);
cgpu->usbinfo.pipe_count++; cgpu->usbinfo.pipe_count++;
applog(LOG_INFO, "%s%i: libusb pipe error, trying to clear", applog(LOG_INFO, "%s%i: libusb pipe error, trying to clear",
@ -2320,6 +2323,7 @@ usb_bulk_transfer(struct libusb_device_handle *dev_handle, int intinfo,
if (err) if (err)
cgpu->usbinfo.clear_fail_count++; cgpu->usbinfo.clear_fail_count++;
} while (err && ++retries < USB_RETRY_MAX);
} }
if ((endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN) if ((endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
memcpy(data, buf, length); memcpy(data, buf, length);