Message ID | 20200729092122.3765539-6-niklas.soderlund@ragnatech.se |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
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@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@jmondi.org> Thanks j > } > } > > -- > 2.27.0 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Niklas, On 29/07/2020 11:07, Jacopo Mondi wrote: > 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@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 '" "Skip registration of a camera with a 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@jmondi.org> I'm not sure where the Fatal reference came from, but I don't think this needs to be fatal. It's not a show stopper for the other cameras in the system. It's an inconvenience of course, but it's reported ;-) Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Thanks > j > >> } >> } >> >> -- >> 2.27.0 >> >> _______________________________________________ >> libcamera-devel mailing list >> libcamera-devel@lists.libcamera.org >> https://lists.libcamera.org/listinfo/libcamera-devel > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel >
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; } }
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@ragnatech.se> --- * Changes since v3 - Update commit message. --- src/libcamera/camera_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)