summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-07-16 16:01:32 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-08-05 20:07:13 +0200
commit673201c4d5ae9f7bd57fa75952934ecb29ba003a (patch)
treeb76aeb484388e9d75f5eff30e968580aa676fd55
parent2e7c80a4f9d4f50a82c674863ce159856c748873 (diff)
libcamera: camera_manager: Enforce unique camera IDs
The camera ID is documented that it should be unique but it's not enforced. Change this by refusing to add cameras to the CameraManager that would create two cameras with the exact same ID. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/camera_manager.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 76543b6a..47d56256 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -182,10 +182,10 @@ void CameraManager::Private::addCamera(std::shared_ptr<Camera> camera,
for (std::shared_ptr<Camera> c : cameras_) {
if (c->id() == camera->id()) {
- LOG(Camera, Warning)
- << "Registering camera with duplicate ID '"
+ LOG(Camera, Fatal)
+ << "Trying to register a camera with a duplicated ID '"
<< camera->id() << "'";
- break;
+ return;
}
}