1
0
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:
Kano 2013-01-23 12:42:33 +11:00
parent d057791915
commit a59b0c0355

View File

@ -815,19 +815,26 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
goto dame; 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 ..."); 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"); applog(LOG_DEBUG, "USB init, kernel detached successfully");
else else {
applog(LOG_WARNING, "USB init, kernel detach failed :("); 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); err = libusb_set_configuration(cgusb->handle, found->config);
if (err) { if (err) {
switch(err) { switch(err) {
case LIBUSB_ERROR_BUSY: 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), found->name, (int)(cgpu->usbinfo.bus_number),
(int)(cgpu->usbinfo.device_address)); (int)(cgpu->usbinfo.device_address));
break; break;