Commit 0615cc8c4a58c39f5433f38605c7e9f06b77175c

Con Kolivas 2014-01-03T16:47:51

Don't return an error in usb read if we've managed to get the whole read length we've asked for.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/usbutils.c b/usbutils.c
index 96896f4..3286cf8 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2677,11 +2677,14 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
 				       cgpu->drv->name, cgpu->device_id, err, libusb_error_name(err));
 			}
 		}
+		ptr += got;
+		bufleft -= got;
+		if (bufleft < 1)
+			err = LIBUSB_SUCCESS;
+
 		if (err || readonce)
 			break;
 
-		ptr += got;
-		bufleft -= got;
 
 		first = false;