|
|
@ -26,27 +26,37 @@ static void bitfury_close(struct cgpu_info *bitfury) |
|
|
|
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BFO_CLOSE); |
|
|
|
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BFO_CLOSE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void bitfury_initialise(struct cgpu_info *bitfury) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bitfury_open(bitfury); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found) |
|
|
|
static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct cgpu_info *bitfury; |
|
|
|
struct cgpu_info *bitfury; |
|
|
|
|
|
|
|
char buf[512]; |
|
|
|
|
|
|
|
int amount; |
|
|
|
|
|
|
|
|
|
|
|
bitfury = usb_alloc_cgpu(&bitfury_drv, 1); |
|
|
|
bitfury = usb_alloc_cgpu(&bitfury_drv, 1); |
|
|
|
|
|
|
|
|
|
|
|
if (!usb_init(bitfury, dev, found)) { |
|
|
|
if (!usb_init(bitfury, dev, found)) { |
|
|
|
bitfury = usb_free_cgpu(bitfury); |
|
|
|
bitfury = usb_free_cgpu(bitfury); |
|
|
|
return false; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
applog(LOG_WARNING, "%s%d: Found at %s", bitfury->drv->name, |
|
|
|
applog(LOG_INFO, "%s%d: Found at %s", bitfury->drv->name, |
|
|
|
bitfury->device_id, bitfury->device_path); |
|
|
|
bitfury->device_id, bitfury->device_path); |
|
|
|
|
|
|
|
|
|
|
|
bitfury_initialise(bitfury); |
|
|
|
usb_buffer_enable(bitfury); |
|
|
|
|
|
|
|
bitfury_open(bitfury); |
|
|
|
|
|
|
|
usb_write(bitfury, "I", 1, &amount, C_BFO_REQINFO); |
|
|
|
|
|
|
|
usb_read(bitfury, buf, 14, &amount, C_BFO_GETINFO); |
|
|
|
|
|
|
|
if (amount != 14) { |
|
|
|
|
|
|
|
applog(LOG_WARNING, "%s%d: Getinfo received %d", |
|
|
|
|
|
|
|
bitfury->drv->name, bitfury->device_id, amount); |
|
|
|
|
|
|
|
goto out_close; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
applog(LOG_INFO, "%s%d: Getinfo returned %s", bitfury->drv->name, |
|
|
|
|
|
|
|
bitfury->device_id, buf); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//return true;
|
|
|
|
|
|
|
|
out_close: |
|
|
|
bitfury_close(bitfury); |
|
|
|
bitfury_close(bitfury); |
|
|
|
|
|
|
|
out: |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|