Many libsigrok drivers do slight different things around libusb_detach_kernel_driver, partially different log messages etc. It would be nice (and yield shorter code, less boilerplate) to factor out this stuff into src/usb.c. E.g. an implementation like this from fx2lafw: if (libusb_has_capability(LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER)) { if (libusb_kernel_driver_active(usb->devhdl, USB_INTERFACE) == 1) { if ((ret = libusb_detach_kernel_driver(usb->devhdl, USB_INTERFACE)) < 0) { sr_err("Failed to detach kernel driver: %s.", libusb_error_name(ret)); ret = SR_ERR; break; } } } The same also applies to re-attaching again after libsigok is done with the device, which is currently not done consistently in all drivers.