Add information for 2nd USB interface on BF1 devices and choose interface 1 for bulk transfers.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
diff --git a/driver-bitfury.c b/driver-bitfury.c
index bd2835c..5952501 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -23,7 +23,7 @@ static void bitfury_empty_buffer(struct cgpu_info *bitfury)
int amount;
do {
- usb_read(bitfury, buf, 512, &amount, C_BF1_FLUSH);
+ usb_read_ii(bitfury, 1, buf, 512, &amount, C_BF1_FLUSH);
} while (amount);
}
@@ -48,7 +48,7 @@ static void bitfury_identify(struct cgpu_info *bitfury)
{
int amount;
- usb_write(bitfury, "L", 1, &amount, C_BF1_IDENTIFY);
+ usb_write_ii(bitfury, 1, "L", 1, &amount, C_BF1_IDENTIFY);
}
static bool bitfury_getinfo(struct cgpu_info *bitfury, struct bitfury_info *info)
@@ -56,8 +56,8 @@ static bool bitfury_getinfo(struct cgpu_info *bitfury, struct bitfury_info *info
char buf[512];
int amount;
- usb_write(bitfury, "I", 1, &amount, C_BF1_REQINFO);
- usb_read(bitfury, buf, 14, &amount, C_BF1_GETINFO);
+ usb_write_ii(bitfury, 1, "I", 1, &amount, C_BF1_REQINFO);
+ usb_read_ii(bitfury, 1, buf, 14, &amount, C_BF1_GETINFO);
if (amount != 14) {
applog(LOG_INFO, "%s %d: Getinfo received %d bytes",
bitfury->drv->name, bitfury->device_id, amount);
@@ -78,8 +78,8 @@ static bool bitfury_reset(struct cgpu_info *bitfury)
char buf[512];
int amount;
- usb_write(bitfury, "R", 1, &amount, C_BF1_REQRESET);
- usb_read_timeout(bitfury, buf, 7, &amount, BF1WAIT, C_BF1_GETRESET);
+ usb_write_ii(bitfury, 1, "R", 1, &amount, C_BF1_REQRESET);
+ usb_read_ii_timeout(bitfury, 1, buf, 7, &amount, BF1WAIT, C_BF1_GETRESET);
if (amount != 7) {
applog(LOG_INFO, "%s %d: Getreset received %d bytes",
@@ -202,7 +202,7 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
cgtime(&tv_now);
ms_diff = 600 - ms_tdiff(&tv_now, &info->tv_start);
if (ms_diff > 0) {
- usb_read_timeout(bitfury, info->buf, 512, &amount, ms_diff, C_BF1_GETRES);
+ usb_read_ii_timeout(bitfury, 1, info->buf, 512, &amount, ms_diff, C_BF1_GETRES);
info->tot += amount;
}
@@ -215,10 +215,10 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
ms_diff = BF1WAIT - ms_tdiff(&tv_now, &info->tv_start);
if (unlikely(ms_diff < 10))
ms_diff = 10;
- usb_read_once_timeout(bitfury, info->buf + info->tot, 7, &amount, ms_diff, C_BF1_GETRES);
+ usb_read_ii_once_timeout(bitfury, 1, info->buf + info->tot, 7, &amount, ms_diff, C_BF1_GETRES);
info->tot += amount;
while (amount) {
- usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES);
+ usb_read_ii_once_timeout(bitfury, 1, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES);
info->tot += amount;
};
@@ -226,10 +226,10 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
goto cascade;
/* Send work */
- usb_write(bitfury, buf, 45, &amount, C_BF1_REQWORK);
+ usb_write_ii(bitfury, 1, buf, 45, &amount, C_BF1_REQWORK);
cgtime(&info->tv_start);
/* Get response acknowledging work */
- usb_read(bitfury, buf, 7, &amount, C_BF1_GETWORK);
+ usb_read_ii(bitfury, 1, buf, 7, &amount, C_BF1_GETWORK);
/* Only happens on startup */
if (unlikely(!info->prevwork[BF1ARRAY_SIZE]))
diff --git a/driver-bitfury.h b/driver-bitfury.h
index db13323..9cbe420 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -16,6 +16,7 @@
#define BF1ARRAY_SIZE 2
struct bitfury_info {
+ struct cgpu_info *base_cgpu;
uint8_t version;
char product[8];
uint32_t serial;
diff --git a/usbutils.c b/usbutils.c
index a79e556..ee36404 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -131,13 +131,18 @@ static struct usb_intinfo bfl_ints[] = {
#endif
#ifdef USE_BITFURY
-static struct usb_epinfo bfu_epinfos[] = {
+static struct usb_epinfo bfu0_epinfos[] = {
+ { LIBUSB_TRANSFER_TYPE_INTERRUPT, 8, EPI(2), 0 }
+};
+
+static struct usb_epinfo bfu1_epinfos[] = {
{ LIBUSB_TRANSFER_TYPE_BULK, 16, EPI(3), 0 },
{ LIBUSB_TRANSFER_TYPE_BULK, 16, EPO(4), 0 }
};
static struct usb_intinfo bfu_ints[] = {
- USB_EPS(1, bfu_epinfos)
+ USB_EPS(0, bfu0_epinfos),
+ USB_EPS(1, bfu1_epinfos)
};
#endif