mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 04:54:26 +00:00
Add commands for getting BF1 bitfury info
This commit is contained in:
parent
9a3684b809
commit
54ac35553f
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,11 @@ struct cg_usb_info {
|
|||||||
USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \
|
USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \
|
||||||
USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") \
|
USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") \
|
||||||
USB_ADD_COMMAND(C_BFO_OPEN, "BF1Open") \
|
USB_ADD_COMMAND(C_BFO_OPEN, "BF1Open") \
|
||||||
USB_ADD_COMMAND(C_BFO_CLOSE, "BF1Close")
|
USB_ADD_COMMAND(C_BFO_CLOSE, "BF1Close") \
|
||||||
|
USB_ADD_COMMAND(C_BFO_REQINFO, "BF1RequestInfo") \
|
||||||
|
USB_ADD_COMMAND(C_BFO_GETINFO, "BF1GetInfo") \
|
||||||
|
USB_ADD_COMMAND(C_BFO_REQRESET, "BF1RequestReset") \
|
||||||
|
USB_ADD_COMMAND(C_BFO_GETRESET, "BF1GetReset")
|
||||||
|
|
||||||
/* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
|
/* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
|
||||||
#define USB_ADD_COMMAND(X, Y) X,
|
#define USB_ADD_COMMAND(X, Y) X,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user