mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-06 01:57:45 +08:00
Cameras: clarify on macOS that Orbbec/RealSense2 need sudo (not udev)
On macOS both SDKs access the camera through libusb, which must seize the USB interface from the system driver - that requires root. Make the device-not-found / access-error messages say "run with sudo" on Apple instead of the Linux-only "udev rules" text. Also fix a dangling %s (no argument) in the Orbbec "device with ID not found" message. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f7d855e798
commit
143f4a744b
@@ -282,16 +282,20 @@ bool CameraOrbbecSDK::init(const std::string & calibrationFolder, const std::str
|
||||
}
|
||||
|
||||
if(device.get() == nullptr) {
|
||||
#ifdef __APPLE__
|
||||
const std::string connectHint = "camera is correctly connected. On macOS the Orbbec "
|
||||
"camera can only be accessed with root privileges, so run the application with sudo.";
|
||||
#else
|
||||
const std::string connectHint = "camera is correctly connected and the udev rules are installed.";
|
||||
#endif
|
||||
if(deviceId_.empty()) {
|
||||
UERROR( "Could not find any orbbec compatible devices! Verify that the "
|
||||
"camera is correctly connected and the udev rules are installed.");
|
||||
UERROR("Could not find any orbbec compatible devices! Verify that the %s", connectHint.c_str());
|
||||
}
|
||||
else {
|
||||
UERROR("Could not find an orbbec device with ID \"%s\"! Verify that the "
|
||||
"camera is correctly connected and the udev rules are installed. "
|
||||
"Unset the ID to choose the first camera found.");
|
||||
UERROR("Could not find an orbbec device with ID \"%s\"! Verify that the %s "
|
||||
"Unset the ID to choose the first camera found.", deviceId_.c_str(), connectHint.c_str());
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -555,7 +559,15 @@ bool CameraOrbbecSDK::init(const std::string & calibrationFolder, const std::str
|
||||
}
|
||||
catch(const ob::Error & e)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
UERROR("Failed to initialize Orbbec camera: %s. On macOS the Orbbec SDK accesses "
|
||||
"the camera through libusb, which must take the USB interface from the system "
|
||||
"UVC driver; this requires root privileges. If this is a USB access error "
|
||||
"(e.g. \"uvc_open failed ... Return Code: -3\"), run the application with sudo.",
|
||||
e.what());
|
||||
#else
|
||||
UERROR("Failed to initialize Orbbec camera: %s", e.what());
|
||||
#endif
|
||||
this->close();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -508,7 +508,14 @@ bool CameraRealSense2::init(const std::string & calibrationFolder, const std::st
|
||||
rs2::device_list list = ctx_.query_devices();
|
||||
if (0 == list.size())
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
UERROR("No RealSense2 devices were found! On macOS the RealSense SDK accesses "
|
||||
"the camera through libusb, which must take the USB interface from the "
|
||||
"system driver; this requires root privileges. If a device is connected "
|
||||
"but not detected, run the application with sudo.");
|
||||
#else
|
||||
UERROR("No RealSense2 devices were found!");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -546,7 +553,12 @@ bool CameraRealSense2::init(const std::string & calibrationFolder, const std::st
|
||||
}
|
||||
catch(const rs2::error & error)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
UWARN("%s. Is the camera already used with another app? On macOS, accessing a "
|
||||
"RealSense camera requires root privileges, so try running with sudo.", error.what());
|
||||
#else
|
||||
UWARN("%s. Is the camera already used with another app?", error.what());
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!found)
|
||||
|
||||
Reference in New Issue
Block a user