|
|
|
@ -2021,7 +2021,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
@@ -2021,7 +2021,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|
|
|
|
struct timeval tv_start; |
|
|
|
|
#endif |
|
|
|
|
struct timeval read_start, tv_finish; |
|
|
|
|
unsigned int initial_timeout, half_time; |
|
|
|
|
unsigned int initial_timeout, sleep_time; |
|
|
|
|
double max, done; |
|
|
|
|
int bufleft, err, got, tot; |
|
|
|
|
__maybe_unused bool first = true; |
|
|
|
@ -2056,7 +2056,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
@@ -2056,7 +2056,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|
|
|
|
bufleft = bufsiz; |
|
|
|
|
err = LIBUSB_SUCCESS; |
|
|
|
|
initial_timeout = timeout; |
|
|
|
|
half_time = initial_timeout / 2; |
|
|
|
|
sleep_time = initial_timeout / 2; |
|
|
|
|
max = ((double)timeout) / 1000.0; |
|
|
|
|
cgtime(&read_start); |
|
|
|
|
while (bufleft > 0) { |
|
|
|
@ -2110,9 +2110,11 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
@@ -2110,9 +2110,11 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|
|
|
|
* if we don't sleep here, but do it only if we're not |
|
|
|
|
* receiving any data. */ |
|
|
|
|
timeout = initial_timeout - (done * 1000); |
|
|
|
|
if (!got && half_time && timeout > half_time) { |
|
|
|
|
timeout -= half_time; |
|
|
|
|
nmsleep(half_time); |
|
|
|
|
if (!got && sleep_time) { |
|
|
|
|
if (timeout <= sleep_time) |
|
|
|
|
sleep_time = timeout - 1; |
|
|
|
|
timeout -= sleep_time; |
|
|
|
|
nmsleep(sleep_time); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2131,7 +2133,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
@@ -2131,7 +2133,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|
|
|
|
endlen = strlen(end); |
|
|
|
|
err = LIBUSB_SUCCESS; |
|
|
|
|
initial_timeout = timeout; |
|
|
|
|
half_time = initial_timeout / 2; |
|
|
|
|
sleep_time = initial_timeout / 2; |
|
|
|
|
max = ((double)timeout) / 1000.0; |
|
|
|
|
cgtime(&read_start); |
|
|
|
|
while (bufleft > 0) { |
|
|
|
@ -2198,9 +2200,11 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
@@ -2198,9 +2200,11 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
timeout = initial_timeout - (done * 1000); |
|
|
|
|
if (!got && half_time && timeout > half_time) { |
|
|
|
|
timeout -= half_time; |
|
|
|
|
nmsleep(half_time); |
|
|
|
|
if (!got && sleep_time) { |
|
|
|
|
if (timeout <= sleep_time) |
|
|
|
|
sleep_time = timeout - 1; |
|
|
|
|
timeout -= sleep_time; |
|
|
|
|
nmsleep(sleep_time); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|