Go back to allowing timeout errors on USB writes to be passed back to the driver without removing the device in case the driver wishes to manage them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/usbutils.c b/usbutils.c
index 6025fa8..d6726ce 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -18,12 +18,9 @@
#include "miner.h"
#include "usbutils.h"
-#define READNODEV(err) ((err) != LIBUSB_SUCCESS && (err) != LIBUSB_ERROR_TIMEOUT)
+#define NODEV(err) ((err) != LIBUSB_SUCCESS && (err) != LIBUSB_ERROR_TIMEOUT)
-/* Timeout errors on writes are basically unrecoverable */
-#define WRITENODEV(err) ((err) != LIBUSB_SUCCESS)
-
-#define NOCONTROLDEV(err) ((err) < 0 && (err) != LIBUSB_SUCCESS)
+#define NOCONTROLDEV(err) ((err) < 0 && NODEV(err))
/*
* WARNING - these assume DEVLOCK(cgpu, pstate) is called first and
@@ -519,7 +516,7 @@ static const char *nodatareturned = "no data returned ";
static const char *debug_false_str = "false";
static const char *nodevstr = "=NODEV";
#define bool_str(boo) ((boo) ? debug_true_str : debug_false_str)
- #define isnodev(err) (READNODEV(err) ? nodevstr : BLANK)
+ #define isnodev(err) (NODEV(err) ? nodevstr : BLANK)
#define USBDEBUG(fmt, ...) applog(LOG_WARNING, fmt, ##__VA_ARGS__)
#else
#define USBDEBUG(fmt, ...)
@@ -2637,7 +2634,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
err = LIBUSB_ERROR_OTHER;
}
out_noerrmsg:
- if (READNODEV(err)) {
+ if (NODEV(err)) {
cg_ruwlock(&cgpu->usbinfo.devlock);
release_cgpu(cgpu);
DEVWUNLOCK(cgpu, pstate);
@@ -2721,7 +2718,7 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
err = LIBUSB_ERROR_OTHER;
}
out_noerrmsg:
- if (WRITENODEV(err)) {
+ if (NODEV(err)) {
cg_ruwlock(&cgpu->usbinfo.devlock);
release_cgpu(cgpu);
DEVWUNLOCK(cgpu, pstate);