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

Use cancellable transfers on bitfury device.

This commit is contained in:
Con Kolivas 2013-10-24 22:26:48 +11:00
parent d2feacdfb2
commit eb5b611483

View File

@ -248,7 +248,7 @@ static int64_t bitfury_scanwork(struct thr_info *thr)
cgtime(&tv_now); cgtime(&tv_now);
ms_diff = 600 - ms_tdiff(&tv_now, &info->tv_start); ms_diff = 600 - ms_tdiff(&tv_now, &info->tv_start);
if (ms_diff > 0) { if (ms_diff > 0) {
usb_read_timeout(bitfury, info->buf, 512, &amount, ms_diff, C_BF1_GETRES); usb_read_timeout_cancellable(bitfury, info->buf, 512, &amount, ms_diff, C_BF1_GETRES);
info->tot += amount; info->tot += amount;
} }
@ -261,8 +261,8 @@ static int64_t bitfury_scanwork(struct thr_info *thr)
ms_diff = BF1WAIT - ms_tdiff(&tv_now, &info->tv_start); ms_diff = BF1WAIT - ms_tdiff(&tv_now, &info->tv_start);
if (unlikely(ms_diff < 10)) if (unlikely(ms_diff < 10))
ms_diff = 10; ms_diff = 10;
usb_read_once_timeout(bitfury, info->buf + info->tot, BF1MSGSIZE, usb_read_once_timeout_cancellable(bitfury, info->buf + info->tot, BF1MSGSIZE,
&amount, ms_diff, C_BF1_GETRES); &amount, ms_diff, C_BF1_GETRES);
info->tot += amount; info->tot += amount;
while (amount) { while (amount) {
usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES); usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES);