USB in linux use the expected kernel config to check and detach - and set the configuration in linux also
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
diff --git a/usbutils.c b/usbutils.c
index 42b23d3..a34028e 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -77,6 +77,7 @@ static struct usb_find_devices find_dev[] = {
.name = "BFL",
.idVendor = 0x0403,
.idProduct = 0x6014,
+ .kernel = 0,
.config = 1,
.interface = 0,
.timeout = BITFORCE_TIMEOUT_MS,
@@ -89,13 +90,14 @@ static struct usb_find_devices find_dev[] = {
.name = "MMQ",
.idVendor = 0x1fc9,
.idProduct = 0x0003,
+ .kernel = 0,
.config = 1,
.interface = 1,
.timeout = MODMINER_TIMEOUT_MS,
.epcount = ARRAY_SIZE(mmq_eps),
.eps = mmq_eps },
#endif
- { DRV_LAST, NULL, 0, 0, 0, 0, 0, 0, NULL }
+ { DRV_LAST, NULL, 0, 0, 0, 0, 0, 0, 0, NULL }
};
#ifdef USE_BITFORCE
@@ -924,9 +926,10 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
goto dame;
}
- if (libusb_kernel_driver_active(cgusb->handle, found->config) == 1) {
+#ifndef WIN32
+ if (libusb_kernel_driver_active(cgusb->handle, found->kernel) == 1) {
applog(LOG_DEBUG, "USB init, kernel attached ... %s", devstr);
- err = libusb_detach_kernel_driver(cgusb->handle, found->config);
+ err = libusb_detach_kernel_driver(cgusb->handle, found->kernel);
if (err == 0) {
applog(LOG_DEBUG,
"USB init, kernel detached successfully %s",
@@ -938,6 +941,7 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
goto cldame;
}
}
+#endif
err = libusb_set_configuration(cgusb->handle, found->config);
if (err) {
@@ -958,8 +962,8 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
err = libusb_get_active_config_descriptor(dev, &config);
if (err) {
applog(LOG_DEBUG,
- "USB init, failed to get config descriptor %d, err %d %s",
- found->config, err, devstr);
+ "USB init, failed to get config descriptor, err %d %s",
+ err, devstr);
goto cldame;
}
diff --git a/usbutils.h b/usbutils.h
index d63122f..ac6ce0c 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -55,6 +55,7 @@ struct usb_find_devices {
const char *name;
uint16_t idVendor;
uint16_t idProduct;
+ int kernel;
int config;
int interface;
unsigned int timeout;