linux-msm / qdl

BSD 3-Clause "New" or "Revised" License
196 stars 76 forks source link

usb: Attempt detaching kernel driver #71

Closed quic-bjorande closed 3 weeks ago

quic-bjorande commented 3 weeks ago

In the event that the kernel have some other driver attached to the device the attempt claim of the interface will fail.

Lost in the libusb conversion was a call to USBDEVFS_DISCONNECT to first detach any such drivers. Reintroduce this by invoking libusb_detach_kernel_driver().

As with some other libusb functions there are multiple return values denoting "success", so rely on libusb_claim_interface() to catch the actual errors.

Reported-by: Maxim Akristiniy Suggested-by: Maxim Akristiniy