This avoids the need to run "rmmod usbtest" on Linux for devices
with the standard Cypress FX2 USB VID/PID (04b4:8613).
devc = sdi->priv;
usb = sdi->conn;
+ if (libusb_has_capability(LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER)) {
+ if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
+ if ((ret = libusb_detach_kernel_driver(usb->devhdl, 0)) < 0) {
+ sr_err("Failed to detach kernel driver: %s.",
+ libusb_error_name(ret));
+ return SR_ERR;
+ }
+ }
+ }
+
/*
* If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY_MS
* milliseconds for the FX2 to renumerate.