mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
usbutils.c use correct config from found (not 0)
This commit is contained in:
parent
d057791915
commit
a59b0c0355
17
usbutils.c
17
usbutils.c
@ -815,19 +815,26 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
||||
goto dame;
|
||||
}
|
||||
|
||||
if (libusb_kernel_driver_active(cgusb->handle, 0) == 1) {
|
||||
if (libusb_kernel_driver_active(cgusb->handle, found->config) == 1) {
|
||||
applog(LOG_DEBUG, "USB init, kernel attached ...");
|
||||
if (libusb_detach_kernel_driver(cgusb->handle, 0) == 0)
|
||||
err = libusb_detach_kernel_driver(cgusb->handle, found->config);
|
||||
if (err == 0)
|
||||
applog(LOG_DEBUG, "USB init, kernel detached successfully");
|
||||
else
|
||||
applog(LOG_WARNING, "USB init, kernel detach failed :(");
|
||||
else {
|
||||
applog(LOG_WARNING,
|
||||
"USB init, kernel detach failed, err %s - %s device %d:%d in use?",
|
||||
err, found->name,
|
||||
(int)(cgpu->usbinfo.bus_number),
|
||||
(int)(cgpu->usbinfo.device_address));
|
||||
goto cldame;
|
||||
}
|
||||
}
|
||||
|
||||
err = libusb_set_configuration(cgusb->handle, found->config);
|
||||
if (err) {
|
||||
switch(err) {
|
||||
case LIBUSB_ERROR_BUSY:
|
||||
applog(LOG_WARNING, "USB init, %s device %d:%d in use",
|
||||
applog(LOG_WARNING, "USB init, set config - %s device %d:%d in use",
|
||||
found->name, (int)(cgpu->usbinfo.bus_number),
|
||||
(int)(cgpu->usbinfo.device_address));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user