libusb_claim_interface fails on Mac OS X Mountain Lion
Asked Answered
G

1

7

I've searched for hours with no avail. I've seen it everywhere that libusb_detach_kernel_driver isn't supported on Mac OS X, but I haven't been able to find a patch or alternative for it.

libusb_claim_interface returns this: libusb: 0.863377 error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access

How can I detach the USB device from the kernel?

Guff answered 27/2, 2013 at 0:39 Comment(4)
Hi George! Have you ever found a solution for this? I'm having the same USBInterfaceOpen error on Mac OS X, Mavericks. No matter what I try, I can't claim my CDC device's interface.Demetra
Unfortunately I have not. If you figure something out, please let us know here!Guff
The closest solution I got is someone telling me to write my own .kext driver file. Also, you might find some help on my StackOverflow question here: #20253850 Best way is to try the serial communication route, which I'm trying out here: microchip.com/forums/…Demetra
Yeah, that's exactly what I ended up doing. If you write that kext, let me know. If you need some help, maybe we could figure something out.Guff
P
3

Many devices automatically have a driver attached to the USB device they are recognised as by OSX and you will not be able to claim the device unless you force the system to detach the device manually before you can run your code and claim the device. If for example it attached the AppleUSBCDC device to some unique usb device you plugged in you'd have to do:

sudo kextunload -b com.apple.driver.AppleUSBCDC

before running your application which tries to claim the interface.

Phonetician answered 29/4, 2015 at 5:23 Comment(5)
In my case it was sudo kextunload -b com.apple.driver.AppleUSBFTDI that fixed the problem. Is there any way to know which driver is actually holding the device?Mandel
I am playing with an arduino nano and wanted to talk to the usb via an android emulator on my mac. Got the same sort of error and found the OS had attached the nano as an FTDI device, so: sudo kextunload -b com.apple.driver.AppleUSBFTDI worked for me.Netti
For macOS Mojave: sudo kextunload -b com.apple.driver.usb.cdc.acmToname
None of above extensions were found on Mojave 10.14.6 (18G87)Monoicous
This is one of three methods discussed in the libusb docs now: github.com/libusb/libusb/wiki/…Athabaska

© 2022 - 2024 — McMap. All rights reserved.