Add BF1 detection code to bitfury driver.
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
diff --git a/cgminer.c b/cgminer.c
index 1677790..29fd52e 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1563,6 +1563,9 @@ static char *opt_verusage_and_exit(const char *extra)
#ifdef USE_BITFORCE
"bitforce "
#endif
+#ifdef USE_BITFURY
+ "bitfury "
+#endif
#ifdef HAVE_OPENCL
"GPU "
#endif
@@ -7352,6 +7355,10 @@ extern struct device_drv bflsc_drv;
extern struct device_drv bitforce_drv;
#endif
+#ifdef USE_BITFURY
+extern struct device_drv bitfury_drv;
+#endif
+
#ifdef USE_ICARUS
extern struct device_drv icarus_drv;
#endif
@@ -7650,6 +7657,10 @@ static void *hotplug_thread(void __maybe_unused *userdata)
bitforce_drv.drv_detect();
#endif
+#ifdef USE_BITFURY
+ bitfury_drv.drv_detect();
+#endif
+
#ifdef USE_MODMINER
modminer_drv.drv_detect();
#endif
@@ -7883,6 +7894,11 @@ int main(int argc, char *argv[])
bitforce_drv.drv_detect();
#endif
+#ifdef USE_BITFURY
+ if (!opt_scrypt)
+ bitfury_drv.drv_detect();
+#endif
+
#ifdef USE_MODMINER
if (!opt_scrypt)
modminer_drv.drv_detect();
diff --git a/driver-bitfury.c b/driver-bitfury.c
index aad2501..f1fd3de 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -14,8 +14,24 @@
struct device_drv bitfury_drv;
+static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
+{
+ struct cgpu_info *bitfury;
+
+ bitfury = usb_alloc_cgpu(&bitfury_drv, 1);
+
+ if (!usb_init(bitfury, dev, found)) {
+ bitfury = usb_free_cgpu(bitfury);
+ return false;
+ }
+ applog(LOG_WARNING, "%s%d: Found at %s", bitfury->drv->name,
+ bitfury->device_id, bitfury->device_path);
+ return true;
+}
+
static void bitfury_detect(void)
{
+ usb_detect(&bitfury_drv, bitfury_detect_one);
}
static bool bitfury_prepare(struct thr_info __maybe_unused *thr)
diff --git a/usbutils.c b/usbutils.c
index 4ce1c33..9bf0b17 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -124,8 +124,8 @@ static struct usb_intinfo bfl_ints[] = {
#ifdef USE_BITFURY
static struct usb_epinfo bfu_epinfos[] = {
- { LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0 },
- { LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(4), 0 }
+ { LIBUSB_TRANSFER_TYPE_BULK, 16, EPI(3), 0 },
+ { LIBUSB_TRANSFER_TYPE_BULK, 16, EPO(4), 0 }
};
static struct usb_intinfo bfu_ints[] = {
@@ -407,6 +407,10 @@ extern struct device_drv bflsc_drv;
extern struct device_drv bitforce_drv;
#endif
+#ifdef USE_BITFURY
+extern struct device_drv bitfury_drv;
+#endif
+
#ifdef USE_MODMINER
extern struct device_drv modminer_drv;
#endif
@@ -2092,6 +2096,11 @@ static struct usb_find_devices *usb_check(__maybe_unused struct device_drv *drv,
return usb_check_each(DRV_BITFORCE, drv, dev);
#endif
+#ifdef USE_BITFURY
+ if (drv->drv_id == DRIVER_BITFURY)
+ return usb_check_each(DRV_BITFURY, drv, dev);
+#endif
+
#ifdef USE_MODMINER
if (drv->drv_id == DRIVER_MODMINER)
return usb_check_each(DRV_MODMINER, drv, dev);
@@ -3304,6 +3313,7 @@ void usb_cleanup()
switch (cgpu->drv->drv_id) {
case DRIVER_BFLSC:
case DRIVER_BITFORCE:
+ case DRIVER_BITFURY:
case DRIVER_MODMINER:
case DRIVER_ICARUS:
case DRIVER_AVALON:
@@ -3443,6 +3453,12 @@ void usb_initialise()
found = true;
}
#endif
+#ifdef USE_BITFURY
+ if (!found && strcasecmp(ptr, bitfury_drv.name) == 0) {
+ drv_count[bitfury_drv.drv_id].limit = lim;
+ found = true;
+ }
+#endif
#ifdef USE_MODMINER
if (!found && strcasecmp(ptr, modminer_drv.name) == 0) {
drv_count[modminer_drv.drv_id].limit = lim;