Uniquely identify the BF1 and BXF bitfury devices.
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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 3331d82..c5b9d64 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -126,26 +126,13 @@ static bool bitfury_reset(struct cgpu_info *bitfury)
return true;
}
-static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
+static bool bxf_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
{
- struct cgpu_info *bitfury;
- struct bitfury_info *info;
-
- bitfury = usb_alloc_cgpu(&bitfury_drv, 1);
-
- if (!usb_init(bitfury, dev, found))
- goto out;
- applog(LOG_INFO, "%s %d: Found at %s", bitfury->drv->name,
- bitfury->device_id, bitfury->device_path);
-
- info = calloc(sizeof(struct bitfury_info), 1);
- if (!info)
- quit(1, "Failed to calloc info in bitfury_detect_one");
- bitfury->device_data = info;
- /* This does not artificially raise hashrate, it simply allows the
- * hashrate to adapt quickly on starting. */
- info->total_nonces = 1;
+ return false;
+}
+static bool bf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
+{
if (!bitfury_open(bitfury))
goto out_close;
@@ -166,15 +153,57 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device
update_usb_stats(bitfury);
applog(LOG_INFO, "%s %d: Successfully initialised %s",
bitfury->drv->name, bitfury->device_id, bitfury->device_path);
+
+ /* This does not artificially raise hashrate, it simply allows the
+ * hashrate to adapt quickly on starting. */
+ info->total_nonces = 1;
+
return true;
out_close:
bitfury_close(bitfury);
- usb_uninit(bitfury);
-out:
- bitfury = usb_free_cgpu(bitfury);
return false;
}
+static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
+{
+ struct cgpu_info *bitfury;
+ struct bitfury_info *info;
+ enum sub_ident ident;
+ bool ret = false;
+
+ bitfury = usb_alloc_cgpu(&bitfury_drv, 1);
+
+ if (!usb_init(bitfury, dev, found))
+ goto out;
+ applog(LOG_INFO, "%s %d: Found at %s", bitfury->drv->name,
+ bitfury->device_id, bitfury->device_path);
+
+ info = calloc(sizeof(struct bitfury_info), 1);
+ if (!info)
+ quit(1, "Failed to calloc info in bitfury_detect_one");
+ bitfury->device_data = info;
+ ident = usb_ident(bitfury);
+ switch (ident) {
+ case IDENT_BF1:
+ ret = bf1_detect_one(bitfury, info);
+ break;
+ case IDENT_BXF:
+ ret = bxf_detect_one(bitfury, info);
+ break;
+ default:
+ applog(LOG_INFO, "%s %d: Unrecognised bitfury device",
+ bitfury->drv->name, bitfury->device_id);
+ break;
+ }
+
+ if (!ret) {
+ usb_uninit(bitfury);
+out:
+ bitfury = usb_free_cgpu(bitfury);
+ }
+ return ret;
+}
+
static void bitfury_detect(bool __maybe_unused hotplug)
{
usb_detect(&bitfury_drv, bitfury_detect_one);
diff --git a/usbutils.c b/usbutils.c
index e29f598..16e383f 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -313,7 +313,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRIVER_bitfury,
.name = "BF1",
- .ident = IDENT_BFU,
+ .ident = IDENT_BF1,
.idVendor = 0x03eb,
.idProduct = 0x204b,
.config = 1,
@@ -323,6 +323,19 @@ static struct usb_find_devices find_dev[] = {
.iProduct = "Bitfury BF1",
INTINFO(bfu_ints)
},
+ {
+ .drv = DRIVER_bitfury,
+ .name = "BXF",
+ .ident = IDENT_BXF,
+ .idVendor = 0x198c,
+ .idProduct = 0xb1f1,
+ .config = 1,
+ .timeout = BITFURY_TIMEOUT_MS,
+ .latency = LATENCY_UNUSED,
+ //.iManufacturer = something,
+ // .iProduct = something,
+ INTINFO(bfu_ints)
+ },
#endif
#ifdef USE_MODMINER
{
diff --git a/usbutils.h b/usbutils.h
index 9a22247..3fbc9cb 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -134,24 +134,25 @@ struct usb_intinfo {
enum sub_ident {
IDENT_UNK = 0,
+ IDENT_AMU,
+ IDENT_AVA,
IDENT_BAJ,
IDENT_BAL,
- IDENT_BAS,
IDENT_BAM,
+ IDENT_BAS,
+ IDENT_BBF,
+ IDENT_BF1,
IDENT_BFL,
- IDENT_BFU,
- IDENT_MMQ,
- IDENT_AVA,
+ IDENT_BLT,
IDENT_BTB,
+ IDENT_BXF,
+ IDENT_CMR1,
+ IDENT_CMR2,
IDENT_HFA,
- IDENT_BBF,
- IDENT_KLN,
IDENT_ICA,
- IDENT_AMU,
- IDENT_BLT,
+ IDENT_KLN,
IDENT_LLT,
- IDENT_CMR1,
- IDENT_CMR2,
+ IDENT_MMQ,
IDENT_ZTX
};