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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user