[darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access
- Why GitHub?
MacOS Monterey 12.0, libuvc, libusb: info [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access #972
hl0521 commented on Aug 4 •
When using the function "uvc_open" in libuvc on MacOS Monterey 12.0, the following exception will be thrown: libusb: info [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access. Does anyone know how to solve this problem? The complete log is as follows:
|
My program use the libuvc (https://github.com/libuvc/libuvc) to control the webcam. The program can work on macOS 10.x and macOS 11.x. It doesn't work on macOS 12.0 that is Apple's new system released recently. The cause is that the function "uvc_open" failed. Function "uvc_open" works as follows: uvc_open Maybe this problem is caused by some changes in Apple’s new system, i'm not sure. And I don't know how to solve this problem, so come here for help. |
I see. Thanks. Maybe there is a change on the Apple side. Anyway, this is a beta release. You may want to try again when there is a formal release. Right now please post the debug log for macOS 11.x as well since you say it works. By comparing the logs, you may be able to identify the differences. It could be that there is a kernel driver in the 12.x beta which opens the device for exclusive access. One thing you can try is to see if you can use the latest addition to the macOS side, the kernel driver detaching function, but you need to have the right entitlement. I have not tried this myself. More details are in pull request #911 |
hl0521 commented on Aug 5 •
On macOS 11.4, the log as follows:
|
mcuee commented on Aug 5 •
Main difference:
macOS 12 beta: claiming interface failed. So there is a kernel driver (or maybe system application) which opened the device for exclusive access. You may have to contact Apple for help.
|
hl0521 commented on Aug 8 •
It works when running with sudo. Thanks. I also found another issue: when calling "uvc_close" in libuvc, the following line of code in function "libusb_free_transfer" oftern lead to program crash. |
Thanks for the updates. Then there is no issue with libusb already. I will close this issue. The proper way (without using sudo) is for the developer to get the right entitlement as per the following discussion: #911
|
You may want to report the issue to libuvc, looks like a bug in libuvc. But if you think it is an issue with libusb, please create a new issue and post the debug log. Thanks. |
Non-VM apps on the App Store have no way to get the 'com.apple.vm.device-access' or run as root by default. |
Thanks for the updates. As for the first sentence, I am not so sure if it is correct or not. I think it is not correct to say "non-VM apps". |
Do not worry too much about the vm in the name. https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_vm_device-access |
Updates on Oct 2021: with the merging of pull request #911, support for detaching kernel drivers with authorization has been added. This will be included in the upcoming 1.0.25 release. Take note the underlying macOS capture APIs only work on the whole device and not on individual interfaces. So this will force all the kernel extensions (drivers) bound to all the interfaces of a USB Composite devices to be released (Issue #920). You will need to get the entitlement from Apple Developer support, create a provisioning profile with that entitlement, and build your app with that profile. Please take note that command line apps cannot use provisioning profiles and therefore cannot hold this entitlement. |
Please refer to the following discussion as well for further info. Apple support seems to say that the 'com.apple.vm.device-access' is not the right entitlement for this purpose. |
mcuee commented 15 days ago •
Ref: libuvc/libuvc#188 If you are just testing, then you can use latest libusb git and sudo. The following is with my Mac Mini M1 running macOS 12.0.1.
|
ANother libuvc issue is here: libuvc/libuvc#194 |
- Team
- Enterprise
- Explore
- Marketplace
- Pricing
-
- Code
- Issues 63
- Pull requests 14
- Actions
- Projects
- Wiki
- Security