Пример #1
0
static struct cgpu_info *hfa_detect_one(libusb_device *dev, struct usb_find_devices *found)
{
    struct cgpu_info *hashfast;

    hashfast = usb_alloc_cgpu(&hashfast_drv, HASHFAST_MINER_THREADS);
    if (!hashfast)
        quit(1, "Failed to usb_alloc_cgpu hashfast");

    if (!usb_init(hashfast, dev, found)) {
        hashfast = usb_free_cgpu(hashfast);
        return NULL;
    }

    hashfast->usbdev->usb_type = USB_TYPE_STD;

    if (!hfa_initialise(hashfast)) {
        hashfast = usb_free_cgpu(hashfast);
        return NULL;
    }
    if (opt_hfa_dfu_boot) {
        hfa_dfu_boot(hashfast);
        hashfast = usb_free_cgpu(hashfast);
        return NULL;
    }
    if (!hfa_detect_common(hashfast)) {
        usb_uninit(hashfast);
        hashfast = usb_free_cgpu(hashfast);
        return NULL;
    }
    if (!add_cgpu(hashfast))
        return NULL;

    return hashfast;
}
Пример #2
0
static bool hfa_detect_one_usb(libusb_device *dev, struct usb_find_devices *found)
{
	struct cgpu_info *hashfast;

	hashfast = usb_alloc_cgpu(&hashfast_drv, HASHFAST_MINER_THREADS);
	if (!hashfast)
		quit(1, "Failed to usb_alloc_cgpu hashfast");

	if (!usb_init(hashfast, dev, found)) {
		hashfast = usb_free_cgpu(hashfast);
		return false;
	}

	hashfast->usbdev->usb_type = USB_TYPE_STD;

	if (!hfa_initialise(hashfast)) {
		hashfast = usb_free_cgpu(hashfast);
		return false;
	}

	add_cgpu(hashfast);

	return hfa_detect_common(hashfast);
}