mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Merge branch 'bflsc' of github.com:ckolivas/cgminer into bflsc
This commit is contained in:
commit
fa5295d0da
@ -807,13 +807,8 @@ static bool bflsc_detect_one(struct libusb_device *dev, struct usb_find_devices
|
|||||||
// TODO: fix ... everywhere ...
|
// TODO: fix ... everywhere ...
|
||||||
bflsc->device_file = (FILE *)sc_info;
|
bflsc->device_file = (FILE *)sc_info;
|
||||||
|
|
||||||
if (!usb_init(bflsc, dev, found)) {
|
if (!usb_init(bflsc, dev, found))
|
||||||
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
|
||||||
bflsc->drv->dname,
|
|
||||||
(int)(bflsc->usbinfo.bus_number),
|
|
||||||
(int)(bflsc->usbinfo.device_address));
|
|
||||||
goto shin;
|
goto shin;
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(devpath, "%d:%d",
|
sprintf(devpath, "%d:%d",
|
||||||
(int)(bflsc->usbinfo.bus_number),
|
(int)(bflsc->usbinfo.bus_number),
|
||||||
|
@ -179,19 +179,13 @@ static bool bitforce_detect_one(struct libusb_device *dev, struct usb_find_devic
|
|||||||
bitforce->deven = DEV_ENABLED;
|
bitforce->deven = DEV_ENABLED;
|
||||||
bitforce->threads = 1;
|
bitforce->threads = 1;
|
||||||
|
|
||||||
if (!usb_init(bitforce, dev, found)) {
|
if (!usb_init(bitforce, dev, found))
|
||||||
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
|
||||||
bitforce->drv->dname,
|
|
||||||
(int)(bitforce->usbinfo.bus_number),
|
|
||||||
(int)(bitforce->usbinfo.device_address));
|
|
||||||
goto shin;
|
goto shin;
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(devpath, "%d:%d",
|
sprintf(devpath, "%d:%d",
|
||||||
(int)(bitforce->usbinfo.bus_number),
|
(int)(bitforce->usbinfo.bus_number),
|
||||||
(int)(bitforce->usbinfo.device_address));
|
(int)(bitforce->usbinfo.device_address));
|
||||||
|
|
||||||
|
|
||||||
// Allow 2 complete attempts if the 1st time returns an unrecognised reply
|
// Allow 2 complete attempts if the 1st time returns an unrecognised reply
|
||||||
ident_first = true;
|
ident_first = true;
|
||||||
retry:
|
retry:
|
||||||
|
@ -126,13 +126,8 @@ static bool modminer_detect_one(struct libusb_device *dev, struct usb_find_devic
|
|||||||
mutex_init(modminer->modminer_mutex);
|
mutex_init(modminer->modminer_mutex);
|
||||||
modminer->fpgaid = (char)0;
|
modminer->fpgaid = (char)0;
|
||||||
|
|
||||||
if (!usb_init(modminer, dev, found)) {
|
if (!usb_init(modminer, dev, found))
|
||||||
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
|
||||||
modminer->drv->dname,
|
|
||||||
(int)(modminer->usbinfo.bus_number),
|
|
||||||
(int)(modminer->usbinfo.device_address));
|
|
||||||
goto shin;
|
goto shin;
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(devpath, "%d:%d",
|
sprintf(devpath, "%d:%d",
|
||||||
(int)(modminer->usbinfo.bus_number),
|
(int)(modminer->usbinfo.bus_number),
|
||||||
|
34
usbutils.c
34
usbutils.c
@ -1217,7 +1217,11 @@ static void release_cgpu(struct cgpu_info *cgpu)
|
|||||||
cgminer_usb_unlock_bd(cgpu->drv, cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address);
|
cgminer_usb_unlock_bd(cgpu->drv, cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found)
|
#define USB_INIT_FAIL 0
|
||||||
|
#define USB_INIT_OK 1
|
||||||
|
#define USB_INIT_IGNORE 2
|
||||||
|
|
||||||
|
static int _usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found)
|
||||||
{
|
{
|
||||||
struct cg_usb_device *cgusb = NULL;
|
struct cg_usb_device *cgusb = NULL;
|
||||||
struct libusb_config_descriptor *config = NULL;
|
struct libusb_config_descriptor *config = NULL;
|
||||||
@ -1226,6 +1230,7 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
unsigned char strbuf[STRBUFLEN+1];
|
unsigned char strbuf[STRBUFLEN+1];
|
||||||
char devstr[STRBUFLEN+1];
|
char devstr[STRBUFLEN+1];
|
||||||
int err, i, j, k;
|
int err, i, j, k;
|
||||||
|
int bad = USB_INIT_FAIL;
|
||||||
|
|
||||||
cgpu->usbinfo.bus_number = libusb_get_bus_number(dev);
|
cgpu->usbinfo.bus_number = libusb_get_bus_number(dev);
|
||||||
cgpu->usbinfo.device_address = libusb_get_device_address(dev);
|
cgpu->usbinfo.device_address = libusb_get_device_address(dev);
|
||||||
@ -1301,9 +1306,11 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
err, devstr);
|
err, devstr);
|
||||||
goto cldame;
|
goto cldame;
|
||||||
}
|
}
|
||||||
if (strcmp((char *)man, found->iManufacturer))
|
if (strcmp((char *)man, found->iManufacturer)) {
|
||||||
|
bad = USB_INIT_IGNORE;
|
||||||
goto cldame;
|
goto cldame;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (found->iProduct) {
|
if (found->iProduct) {
|
||||||
unsigned char prod[STRBUFLEN+1];
|
unsigned char prod[STRBUFLEN+1];
|
||||||
@ -1317,9 +1324,11 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
err, devstr);
|
err, devstr);
|
||||||
goto cldame;
|
goto cldame;
|
||||||
}
|
}
|
||||||
if (strcmp((char *)prod, found->iProduct))
|
if (strcmp((char *)prod, found->iProduct)) {
|
||||||
|
bad = USB_INIT_IGNORE;
|
||||||
goto cldame;
|
goto cldame;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = libusb_set_configuration(cgusb->handle, found->config);
|
err = libusb_set_configuration(cgusb->handle, found->config);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -1435,7 +1444,7 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
cgpu->drv->name = (char *)(found->name);
|
cgpu->drv->name = (char *)(found->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return USB_INIT_OK;
|
||||||
|
|
||||||
cldame:
|
cldame:
|
||||||
|
|
||||||
@ -1448,7 +1457,22 @@ dame:
|
|||||||
|
|
||||||
cgusb = free_cgusb(cgusb);
|
cgusb = free_cgusb(cgusb);
|
||||||
|
|
||||||
return false;
|
return bad;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = _usb_init(cgpu, dev, found);
|
||||||
|
|
||||||
|
if (ret == USB_INIT_FAIL)
|
||||||
|
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
||||||
|
cgpu->drv->dname,
|
||||||
|
(int)(cgpu->usbinfo.bus_number),
|
||||||
|
(int)(cgpu->usbinfo.device_address));
|
||||||
|
|
||||||
|
return (ret == USB_INIT_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool usb_check_device(struct device_drv *drv, struct libusb_device *dev, struct usb_find_devices *look)
|
static bool usb_check_device(struct device_drv *drv, struct libusb_device *dev, struct usb_find_devices *look)
|
||||||
|
Loading…
Reference in New Issue
Block a user