[libcamera-devel] [PATCH v4 5/5] libcamera: camera_manager: Enforce unique camera names

Jacopo Mondi jacopo at jmondi.org
Wed Jul 29 12:07:23 CEST 2020


Hi Niklas,

On Wed, Jul 29, 2020 at 11:21:22AM +0200, Niklas Söderlund wrote:
> The camera name have always been documented that it should be unique but
> it has never been enforced. Change this by refusing to add cameras to
> the CameraManager that would create two cameras with the exact same
> name.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> * Changes since v3
> - Update commit message.
> ---
>  src/libcamera/camera_manager.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index f60491d2c1a7500f..7d83263f1fabf5da 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -178,10 +178,10 @@ void CameraManager::Private::addCamera(std::shared_ptr<Camera> camera,
>
>  	for (std::shared_ptr<Camera> c : cameras_) {
>  		if (c->name() == camera->name()) {
> -			LOG(Camera, Warning)
> -				<< "Registering camera with duplicate name '"
> +			LOG(Camera, Error)
> +				<< "Skip registering camera with duplicated name '"
>  				<< camera->name() << "'";
> -			break;
> +			return;

Sorry, I think I forgot my tag in the previous version.

On using FATAL, this error should only happen while developing a new
pipeline handler I think, and it's anyway a showstopper, so I wouldn't
mind. Up to you.

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j

>  		}
>  	}
>
> --
> 2.27.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list