mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Set the avalon read transfer latency to avoid sleeping when no data is returned after very short latency settings.
This commit is contained in:
parent
dd5788762f
commit
5e94a97223
@ -498,6 +498,16 @@ static void avalon_initialise(struct cgpu_info *avalon)
|
||||
if (avalon->usbinfo.nodev)
|
||||
return;
|
||||
|
||||
// Set latency
|
||||
err = usb_transfer(avalon, FTDI_TYPE_OUT, FTDI_REQUEST_LATENCY,
|
||||
AVALON_READ_TIMEOUT, interface, C_LATENCY);
|
||||
|
||||
applog(LOG_DEBUG, "%s%i: latency got err %d",
|
||||
avalon->drv->name, avalon->device_id, err);
|
||||
|
||||
if (avalon->usbinfo.nodev)
|
||||
return;
|
||||
|
||||
// Set data
|
||||
err = usb_transfer(avalon, FTDI_TYPE_OUT, FTDI_REQUEST_DATA,
|
||||
FTDI_VALUE_DATA_AVA, interface, C_SETDATA);
|
||||
@ -745,7 +755,6 @@ static void *avalon_get_results(void *userdata)
|
||||
RenameThread(threadname);
|
||||
|
||||
while (likely(!avalon->shutdown)) {
|
||||
struct timeval tv_start, now, tdiff;
|
||||
unsigned char buf[rsize];
|
||||
int ret;
|
||||
|
||||
@ -767,20 +776,11 @@ static void *avalon_get_results(void *userdata)
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
cgtime(&tv_start);
|
||||
ret = avalon_read(avalon, buf, rsize, AVALON_READ_TIMEOUT,
|
||||
C_AVALON_READ);
|
||||
|
||||
if (ret < 1) {
|
||||
int us_delay;
|
||||
|
||||
cgtime(&now);
|
||||
timersub(&now, &tv_start, &tdiff);
|
||||
us_delay = AVALON_READ_TIMEOUT * 1000 - (tdiff.tv_usec);
|
||||
if (us_delay > 0)
|
||||
nusleep(us_delay);
|
||||
if (ret < 1)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opt_debug) {
|
||||
applog(LOG_DEBUG, "Avalon: get:");
|
||||
|
Loading…
Reference in New Issue
Block a user