fx2lafw: Fix #445 by detaching the kernel driver (if any)
This avoids the need to run "rmmod usbtest" on Linux for devices with the standard Cypress FX2 USB VID/PID (04b4:8613).
This commit is contained in:
parent
536141ff49
commit
39e4517759
|
@ -370,6 +370,16 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue