Add complete close sequence to bf1 as it happens on serial.
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
diff --git a/driver-bitfury.c b/driver-bitfury.c
index c039e7a..356a69d 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -14,26 +14,30 @@
struct device_drv bitfury_drv;
+static void bitfury_empty_buffer(struct cgpu_info *bitfury)
+{
+ char buf[512];
+ int amount;
+
+ do {
+ usb_read(bitfury, buf, 512, &amount, C_PING);
+ } while (amount);
+}
+
static void bitfury_open(struct cgpu_info *bitfury)
{
/* Magic open sequence */
usb_transfer(bitfury, 0x21, 0x22, 0x0003, 0, C_BFO_OPEN);
+ bitfury_empty_buffer(bitfury);
}
static void bitfury_close(struct cgpu_info *bitfury)
{
/* Magic close sequence */
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BFO_CLOSE);
-}
-
-static void bitfury_empty_buffer(struct cgpu_info *bitfury)
-{
- char buf[512];
- int amount;
-
- do {
- usb_read(bitfury, buf, 512, &amount, C_PING);
- } while (amount);
+ bitfury_empty_buffer(bitfury);
+ usb_transfer(bitfury, 0x23, 0x08, 0x9053, 1, C_BFO_CLOSE);
+ bitfury_empty_buffer(bitfury);
}
static void bitfury_identify(struct cgpu_info *bitfury)
@@ -64,7 +68,6 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device
quit(1, "Failed to calloc info in bitfury_detect_one");
bitfury->device_data = info;
- bitfury_empty_buffer(bitfury);
usb_buffer_enable(bitfury);
bitfury_open(bitfury);