static bool hfa_initialise(struct cgpu_info *hashfast) { int err; if (hashfast->usbinfo.nodev) return false; hfa_clear_readbuf(hashfast); err = usb_transfer(hashfast, 0, 9, 1, 0, C_ATMEL_RESET); if (!err) err = usb_transfer(hashfast, 0x21, 0x22, 0, 0, C_ATMEL_OPEN); if (!err) { uint32_t buf[2]; /* Magic sequence to reset device only really needed for windows * but harmless on linux. */ buf[0] = 0x80250000; buf[1] = 0x00000800; err = usb_transfer_data(hashfast, 0x21, 0x20, 0x0000, 0, buf, 7, C_ATMEL_INIT); } if (err < 0) { applog(LOG_INFO, "HFA %d: Failed to open with error %s", hashfast->device_id, libusb_error_name(err)); } /* Must have transmitted init sequence sized buffer */ return (err == 7); }
static void _transfer(struct cgpu_info *gridseed, uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint32_t *data, int siz, enum usb_cmds cmd) { int err; err = usb_transfer_data(gridseed, request_type, bRequest, wValue, wIndex, data, siz, cmd); applog(LOG_DEBUG, "%s: cgid %d %s got err %d", gridseed->drv->name, gridseed->sgminer_id, usb_cmdname(cmd), err); }