mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-12 06:02:01 +00:00
libztex: Add firmware download support for ZTEX 1.15d and 1.15x
The correct firmware file is automatically determined based on the ZTEX descriptor in the dummy firmware.
This commit is contained in:
parent
f967392877
commit
1203f1f621
44
libztex.c
44
libztex.c
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* libztex.c - Ztex 1.15x fpga board support library
|
* libztex.c - Ztex 1.15x/1.15y fpga board support library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 nelisky.btc@gmail.com
|
* Copyright (c) 2012 nelisky.btc@gmail.com
|
||||||
* Copyright (c) 2012 Denis Ahrens <denis@h3q.com>
|
* Copyright (c) 2012 Denis Ahrens <denis@h3q.com>
|
||||||
@ -105,7 +105,6 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev)
|
|||||||
int i, ret = CHECK_ERROR, err, cnt;
|
int i, ret = CHECK_ERROR, err, cnt;
|
||||||
size_t got_bytes, length;
|
size_t got_bytes, length;
|
||||||
unsigned char buf[64], *fw_buf;
|
unsigned char buf[64], *fw_buf;
|
||||||
char *firmware = "ztex_ufm1_15y1.bin";
|
|
||||||
|
|
||||||
err = libusb_get_device_descriptor(dev, &desc);
|
err = libusb_get_device_descriptor(dev, &desc);
|
||||||
if (unlikely(err != 0)) {
|
if (unlikely(err != 0)) {
|
||||||
@ -145,9 +144,8 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev)
|
|||||||
switch(buf[7])
|
switch(buf[7])
|
||||||
{
|
{
|
||||||
case 13:
|
case 13:
|
||||||
applog(LOG_ERR, "Found ztex board 1.15d or 1.15x but currently unsupported!");
|
applog(LOG_ERR, "Found ztex board 1.15d or 1.15x");
|
||||||
ret = CHECK_IS_NOT_ZTEX;
|
break;
|
||||||
goto done;
|
|
||||||
case 15:
|
case 15:
|
||||||
applog(LOG_ERR, "Found ztex board 1.15y");
|
applog(LOG_ERR, "Found ztex board 1.15y");
|
||||||
break;
|
break;
|
||||||
@ -163,7 +161,41 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
applog(LOG_ERR, "Found dummy firmware, trying to send mining firmware: %s", firmware);
|
applog(LOG_ERR, "Found dummy firmware, trying to send mining firmware");
|
||||||
|
|
||||||
|
char productString[32];
|
||||||
|
|
||||||
|
cnt = libztex_get_string_descriptor_ascii(hndl, desc.iProduct, productString, sizeof(productString));
|
||||||
|
if (unlikely(cnt < 0)) {
|
||||||
|
applog(LOG_ERR, "Ztex check device: Failed to read device productString with err %d", cnt);
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
applog(LOG_ERR, "productString: %s", productString);
|
||||||
|
|
||||||
|
unsigned char productID2 = buf[7];
|
||||||
|
char *firmware = NULL;
|
||||||
|
|
||||||
|
if (strcmp("USB-FPGA Module 1.15d (default)", productString) == 0 && productID2 == 13)
|
||||||
|
{
|
||||||
|
firmware = "ztex_ufm1_15d4.bin";
|
||||||
|
}
|
||||||
|
else if (strcmp("USB-FPGA Module 1.15x (default)", productString) == 0 && productID2 == 13)
|
||||||
|
{
|
||||||
|
firmware = "ztex_ufm1_15d4.bin";
|
||||||
|
}
|
||||||
|
else if (strcmp("USB-FPGA Module 1.15y (default)", productString) == 0 && productID2 == 15)
|
||||||
|
{
|
||||||
|
firmware = "ztex_ufm1_15y1.bin";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firmware == NULL)
|
||||||
|
{
|
||||||
|
applog(LOG_ERR, "could not figure out which firmware to use");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
applog(LOG_ERR, "Mining firmware filename: %s", firmware);
|
||||||
|
|
||||||
fp = open_bitstream("ztex", firmware);
|
fp = open_bitstream("ztex", firmware);
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user