librealsense
librealsense copied to clipboard
librealsense fails to claim USB interface on MacOS Monterey
Required Info | |
---|---|
Camera Model | D415 |
Firmware Version | N/A |
Operating System & Version | MacOS Monterey (12.0.1) |
SDK Version | 2.49 |
Language | python |
Issue Description
After upgrading my machine from macOS Catalina (10.15.6) to Monterey (12.0.1), all RealSense applications I have and pyrealsense2 code I’ve written -- which all previously ran without issue -- are broken. They all give me the same error message: failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS. I’ve verified both physically and via System Preferences that the D415 is connected to the machine with a USB 3 connection using the same cable that the D415 was shipped with.
When I run rs-enumerate-devices, I get:
> rs-enumerate-devices
Could not create device - failed to set power state . Check SDK logs for details
02/11 16:49:13,578 ERROR [0x70000cff3000] (handle-libusb.h:95) failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
When I run realsense-viewer, I get:
> realsense-viewer
02/11 16:52:08,669 ERROR [0x70000c115000] (handle-libusb.h:95) failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
02/11 16:52:08,669 ERROR [0x70000bf8c000] (sensor.cpp:537) acquire_power failed: failed to set power state
02/11 16:52:08,673 WARNING [0x70000bf8c000] (rs.cpp:308) null pointer passed for argument “device”
02/11 16:52:08,673 WARNING [0x70000bf8c000] (rs.cpp:2621) Couldn’t refresh devices - failed to set power state
I wondered if something was wrong with the device firmware and tried updating it, which gives me:
> rs-fw-update -l
connected devices:
03/11 14:56:46,495 ERROR [0x70000b0b1000] (handle-libusb.h:95) failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
RealSense error calling rs2_create_device(info_list:0x600003554e70, index:0):
failed to set power state
03/11 14:56:46,497 ERROR [0x119b34600] (sensor.cpp:537) acquire_power failed: failed to set power state
I uninstalled and then rebuilt librealsense from scratch for Monterey using the newest version of Xcode that’s Monterey compatible, but these issues still persist even after that. The librealsense homebrew page indicates that Monterey is supported. I’d greatly appreciate any guidance on fixing the failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS problem for Monterey, thank you!
Hi @dominiccarrano May I first confirm please whether you are using an Intel-based Mac computer or a newer Apple Silicon M1 model.
If you do have an Intel based Mac, have you attempted to build librealsense from a binary with brew using brew install librealsense
If you have chosen not to install librealsense with a brew binary because you require pyrealsense2 to be installed too, a RealSense Mac user recently shared a method in https://github.com/IntelRealSense/librealsense/issues/9687 that they developed to install a pre-built pyrealsense2 on Mac using pip install.
Hi @MartyG-RealSense, thanks for the quick response! I'm on an Intel-based Mac.
I've separately tried:
- brew install librealsense
- The steps described in this link
- The method you've linked (although the author says it's only supported on Catalina and Big Sur, not Monterey)
and all produce this same RS2_USB_STATUS_ACCESS error.
As you were earlier able to successfully use the camera on the same Mac with Catalina, that would make it unlikely that hardware problems with the camera or with the Mac computer are the cause of this problem. It could be an OS software issue with Monterey.
Is your camera plugged into a hub? There have been reports of USB detection issues recently from Mac users who have upgraded to Monterey, particularly with hubs. An example discussion from the past week is in the link below.
https://www.macrumors.com/2021/10/29/monterey-usb-hub-issues-reported/
Thank you for the link, I wasn't aware of this. The camera was plugged into a hub, which had no issues on Catalina. But even after plugging it into the machine with a direct USB3 connection, I get the same error.
My understanding from perusing previous issues on this GitHub is that RS2_USB_STATUS_ACCESS typically means that libusb had trouble reading from a USB due to something permissions related. Is there any guidance from Intel on troubleshooting this for Mac (Monterey in particular)? I haven't been able to find anything online about how to debug this that wasn't specific to Linux.
I researched the Monterey USB problem further. In the majority of cases, waiting for Apple to release a fix in a patch seemed to be the most common advice.
There was one case where a Mac user restored access to their webcam in Monterey by resetting the Mac permissions with the command tccutil reset All in the terminal.
I have the same error as @dominiccarrano and have walked through the same troubleshooting with the exact same results. Also an Intel Mac with Monterey that used to be a happy RealSense user with Big Sur.
First tried: tccutil reset Camera Then tried: tccutil reset All
Still getting the RS2_USB_STATUS_ACCESS errors. If anyone finds a fix I'd love to know about it.
@jeredhdean Thanks very much for your report!
@dominiccarrano Have you found any solutions since your last report, please?
I got the same result as @jeredhdean: still have RS2_USB_STATUS_ACCESS after each of those tccutil reset commands.
Reports about the Monterey USB issues strongly indicate that Thunderbolt ports are not affected. Thunderbolt ports accept USB-C connections. So conceivably, a camera might work if attached to a Thunderbolt port via a USB-A to USB-C adapter or a USB cable with USB-C micro sized connectors on both ends of the cable.
Point number 3 of a guide to the Monterey USB issue in the link below suggests trying resetting the System Management Controller (SMC).
https://cleanmymac.com/blog/usb-devices-disconnecting-monterey
Thanks for the additional info on this, @MartyG-RealSense. Unfortunately, using a Thunderbolt connection instead didn't fix the issue, nor did an SMC reset. I should mention that this is on a late 2014 Mac mini with no Thunderbolt 3 (i.e., USB-C) ports, so I was using Thunderbolt 2 during that attempt.
However, when I booted up the Mac in Safe Mode the camera did work. In Safe Mode, rs-enumerate-devices
and rs-fw-update -l
behaved just as expected without any RS2_USB_STATUS_ACCESS error, and I was able to use pyrealsense2 to stream RGB-D frames within a Python shell. I couldn't use realsense-viewer
in Safe Mode due to some component of glfw3 being blocked or failing. After rebooting the Mac again normally (i.e., not in Safe Mode), I got the same set of errors as before. I then tried all the suggestions under "If the issue doesn't continue in safe mode" (https://support.apple.com/en-us/HT201262), but still no luck.
Thanks very much @dominiccarrano for the information about being able to access the camera in Safe Mode! It seems likely though that a resolution for this issue will have to come from Apple's side via an update for Monterey.
I am getting the same error in MacOS Monterey, but I don't think it is the same as the Monterey USB hub issue.
This code:
import pyrealsense2.pyrealsense2 as rs
ctx = rs.context()
print(len(ctx.devices))
Will print "1" when a RealSense camera is connected, so the python wrapper can tell that a device is connected.
But if I try to read and print the camera's serial number:
for i in range(len(ctx.devices)):
sn = ctx.devices[i].get_info(rs.camera_info.serial_number)
print(sn)
it will fail with RuntimeError: failed to set power state
None of the built example or realsense-viewer will be able to access the device properly.
Under system report MacOS can clearly see that a realsense device is connected under Hardware > USB
Intel(R) RealSense(TM) Depth Camera 455 :
Product ID: 0x0b5c
Vendor ID: 0x8086 (Intel Corporation)
Version: 50.d0
Serial Number: 110223061847
Speed: Up to 5 Gb/s
Manufacturer: Intel(R) RealSense(TM) Depth Camera 455
Location ID: 0x01210000 / 3
Current Available (mA): 900
Current Required (mA): 720
Extra Operating Current (mA): 0
The device is also visible under Hardware > Camera
Intel(R) RealSense(TM) Depth Camera 455 :
Model ID: UVC Camera VendorID_32902 ProductID_2908
Unique ID: 0x121000080860b5c
Interestingly if I open Apple's Photobooth App Intel(R) RealSense(TM) Depth Camera 455
is available as an option along with FaceTime HD Camera
. When selected it will show the RGB-Infrared stream and the IR projector is on at full power.
To me it seems that MacOS is able to power and access the RealSense camera without issue. There is something that Apple has changed that is causing the RealSense SDK to not work properly. This will likely require a change to the SDK that someone from Intel will need to investigate.
Thanks very much everyone for your reports. I will highlight the issue to Intel.
I'm facing the same issue as well, with L515.
I also have the same issue with D415 and D435
Confirmed the same behavior on both a late 2019 Intel MacBook Pro as well as a late 2021 M1 Pro MacBook Pro.
MacOS Monterey Version 12.0.1 RealSense SDK Version 2.50.0 and FW 5.13.0.50
I discussed this case with my Intel RealSense colleagues. We will wait for Apple to release a fix for Monterey first. Then we can see if RealSense related problems are still present after that.
How does that make sense? If the issue was USB then you would not be able to access the camera at all. It appears the issue is with the SDK.
Ran a few more experiments (all with the system booted up normally, i.e. not in Safe Mode):
- I can use the D415 in Photo Booth to take photos and videos, so macOS itself doesn't seem to have an issue with accessing the camera.
- From digging through the librealsense source code, I found that
RS2_USB_STATUS_ACCESS
is an alias forLIBUSB_ERROR_ACCESS
, which typically indicates a permissions error. I gavers-enumerate-devices
full permissions by going into System Preferences > Security & Privacy > Full Disk Access and adding the application, and then re-ran it. I still got the same bug, but the error message was slightly more verbose:
> rs-enumerate-devices # without full disk access
Could not create device - failed to set power state . Check SDK logs for details
16/11 10:03:06,047 ERROR [0x70000c0c7000] (handle-libusb.h:95) failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
> rs-enumerate-devices # with full disk access
16/11 10:01:42,062 ERROR [0x70000f7f3000] (handle-libusb.h:95) failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
Could not create device - failed to set power state . Check SDK logs for details
16/11 10:01:42,063 ERROR [0x10edef600] (sensor.cpp:537) acquire_power failed: failed to set power state
@dominiccarrano if it were a camera permissions issue Full Disk Access would not make a difference, it would need to be Camera. Unfortunately you cannot pre enable an application for camera access, the application has to request it.
Interestingly opencv-python is also able to access and display an infrared feed from an attached RealSense camera similar to how photobooth is (once terminal or whatever application is running python is given camera permission).
@MartyG-RealSense it really seems like the onus is on Intel to investigate and fix this.
I have been facing the same issue since I updated to macOS Monterey.
The camera appears in the USB list and I can properly use it as a webcam.
@MartyG-RealSense May I first confirm please whether you are using an Intel-based Mac computer or a newer Apple Silicon M1 model.
To avoid spending time on testing different architectures, the chipset is irrelevant to this issue. I have compiled RealSense for Intel (x86_64), Apple Silicon (arm64), and Universal (x86_64 + arm64) and I've used it without any problems in Big Sur.
Here's the test: I created a universal RealSense build on my M1 machine (Monterey). Obviously, it did not work on Monterey. However, when I used that exact same build on an Intel machine (Big Sur), it worked fine.
Same for x86 and ARM builds: they work on Big Sur, but not on Monterey.
Also, I recompiled libusb (latest version) and linked that to RealSense. No luck.
It seems this issue is related to Monterey and power delivery over USB.
@sam598 If the issue was USB then you would not be able to access the camera at all. It appears the issue is with the SDK.
The RealSense SDK uses the sensor in full power. I guess that's why it requires a dedicated USB-3/C. All other apps (like FaceTime or Photobooth) use RealSense as a webcam, limiting it to 30 FPS.
There are numerous user reports here. So, for now, I tend to agree with @MartyG-RealSense that it's something Apple should work on. However, I'm keeping the thread alive to ensure Intel engineers will take care of that for version 2.50.
As a side-note on the subject of Monterey, it is worth highlighting that the simple installation procedure brew install librealsense now supports Monterey.
https://formulae.brew.sh/formula/librealsense
On macOS Big Sur 11.6.1, I am also seeing this issue using an M1 Mac mini.
This install of Big Sur is absolutely fresh (a downgrade from macOS 12.0), I have only installed Xcode and the brew installs outlined on the Intel Dev site. The install was a downgrade from Monterrey specifically to get librealsense working.
I have the following output from
Starting Xcode
Running realsense-viewer
Initial fail and then
Unplugging and re-plugging the camera in several times:
2021-11-29 12:52:33.855654+0000 realsense-viewer[18210:105475] Metal API Validation Enabled
2021-11-29 12:52:33.880607+0000 realsense-viewer[18210:105475] fopen failed for data file: errno = 2 (No such file or directory)
2021-11-29 12:52:33.880635+0000 realsense-viewer[18210:105475] Errors found! Invalidating cache...
2021-11-29 12:52:33.927411+0000 realsense-viewer[18210:105475] +[MTLIOAccelDevice registerDevices]: Zero Metal services found
29/11 12:52:34,132 ERROR [0x17062f000] (handle-libusb.h:61) failed to set kernel driver auto detach: 0, error: RS2_USB_STATUS_NOT_SUPPORTED
29/11 12:52:34,133 ERROR [0x17048b000] (sensor.cpp:572) acquire_power failed: failed to set power state
29/11 12:52:34,134 WARNING [0x17048b000] (rs.cpp:310) null pointer passed for argument "device"
29/11 12:52:34,134 WARNING [0x17048b000] (rs.cpp:2691) Couldn't refresh devices - failed to set power state
29/11 12:53:38,472 ERROR [0x1706bb000] (handle-libusb.h:61) failed to set kernel driver auto detach: 0, error: RS2_USB_STATUS_NOT_SUPPORTED
29/11 12:53:38,472 ERROR [0x101fefd40] (sensor.cpp:572) acquire_power failed: failed to set power state
29/11 12:53:38,473 WARNING [0x101fefd40] (rs.cpp:310) null pointer passed for argument "device"
29/11 12:53:38,473 WARNING [0x101fefd40] (rs.cpp:2691) Couldn't refresh devices - failed to set power state
29/11 12:53:54,563 ERROR [0x1706bb000] (handle-libusb.h:61) failed to set kernel driver auto detach: 0, error: RS2_USB_STATUS_NOT_SUPPORTED
29/11 12:53:54,563 ERROR [0x101fefd40] (sensor.cpp:572) acquire_power failed: failed to set power state
29/11 12:53:54,564 WARNING [0x101fefd40] (rs.cpp:310) null pointer passed for argument "device"
29/11 12:53:54,564 WARNING [0x101fefd40] (rs.cpp:2691) Couldn't refresh devices - failed to set power state
29/11 12:54:45,116 ERROR [0x1706bb000] (handle-libusb.h:61) failed to set kernel driver auto detach: 0, error: RS2_USB_STATUS_NOT_SUPPORTED
29/11 12:54:45,116 ERROR [0x101fefd40] (sensor.cpp:572) acquire_power failed: failed to set power state
29/11 12:54:45,118 WARNING [0x101fefd40] (rs.cpp:310) null pointer passed for argument "device"
29/11 12:54:45,118 WARNING [0x101fefd40] (rs.cpp:2691) Couldn't refresh devices - failed to set power state
I built the latest using master which I downloaded as a zip today.
I followed the build instructions from the Intel Dev site. Except for using the cmake command from #9999
Code is sitting in and running from my ~/Downloads
folder
As a side-note on the subject of Monterey, it is worth highlighting that the simple installation procedure brew install librealsense now supports Monterey.
Note: Supports Monterey on Intel Macs only. M1 is still not supported by the standard installation procedure.
We've just tried the SDK on an Intel mac with Monterrey and can confirm RS2_USB_STATUS_NOT_SUPPORTED
. Tried an install both from brew and building it ourselves with this repo's code.
I have just tried installing with brew install librealsense
on this Intel Mac:
However, I'm getting the same USB not supported error:
joes-imac:~ joe$ realsense-viewer
06/12 10:42:22,506 ERROR [0x700009caf000] (handle-libusb.h:95) failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
06/12 10:42:22,507 ERROR [0x700009b26000] (sensor.cpp:537) acquire_power failed: failed to set power state
06/12 10:42:22,508 WARNING [0x700009b26000] (rs.cpp:308) null pointer passed for argument "device"
06/12 10:42:22,508 WARNING [0x700009b26000] (rs.cpp:2621) Couldn't refresh devices - failed to set power state
As a side-note on the subject of Monterey, it is worth highlighting that the simple installation procedure brew install librealsense now supports Monterey.
Note: Supports Monterey on Intel Macs only. M1 is still not supported by the standard installation procedure.
@Vangos how did you get it to work on an Intel Mac?
@Vangos how did you get it to work on an Intel Mac?
Just to clarify: in my setup, it never worked on Monterey (check my previous comment). @MartyG-RealSense mentioned:
As a side-note on the subject of Monterey, it is worth highlighting that the simple installation procedure brew install librealsense now supports Monterey.
I have no reason to doubt that, but I have downgraded my Intel Mac to Big Sur.
All my M1 Macs are running Monterey, and neither the official brew install
procedure nor a custom compilation is working.
Thanks everyone for your ongoing reports. I am keeping Intel updated on this issue.
The internet is smeared with Monterey & USB3 data issues. This seems to be a known issue since half a year, it existed in Monterey beta. Unfortunately, it persists even in the current 12.1 beta :( Seems like downgrade to BigSur is the only viable option in the near future.
Unfortunately, issue still there after MacOS 12.1 update. No known workaround.