libcamera: camera_manager: Non-fatal duplicate id detection
diff mbox series

Message ID 20261026165640.3755874-1-kieran.bingham@ideasonboard.com
State New
Headers show
Series
  • libcamera: camera_manager: Non-fatal duplicate id detection
Related show

Commit Message

Kieran Bingham Oct. 26, 2026, 4:56 p.m. UTC
There are some hardware configurations which currently generate a
duplicate camera ID when the camera is on a shared but multiplexed bus.

At present this is somewhat difficult to adapt to ensure a consistent
and unique id.

While this case is undesired, it presently causes libcamera to hit a
Fatal asssertion on real world hardware which then causes pipewire to
close.

This behaviour is even less desirable, and we can easily continue to
operate libcamera without a potentially duplicate camera.

Reduce the Fatal log level to an Error allowing the code to continue
without constructing this duplicate camera.

Closes: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/303
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/camera_manager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Barnabás Pőcze Oct. 26, 2026, 5:02 p.m. UTC | #1
2026. 10. 26. 17:56 keltezéssel, Kieran Bingham írta:
> There are some hardware configurations which currently generate a
> duplicate camera ID when the camera is on a shared but multiplexed bus.
> 
> At present this is somewhat difficult to adapt to ensure a consistent
> and unique id.
> 
> While this case is undesired, it presently causes libcamera to hit a
> Fatal asssertion on real world hardware which then causes pipewire to
> close.
> 
> This behaviour is even less desirable, and we can easily continue to
> operate libcamera without a potentially duplicate camera.
> 
> Reduce the Fatal log level to an Error allowing the code to continue
> without constructing this duplicate camera.
> 
> Closes: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/303

Could this be "downgraded" to "Link" or similar? I would like to keep the
issue open.

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>



> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>   src/libcamera/camera_manager.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 0dd4e0c590a1..9c9073053710 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -210,7 +210,7 @@ void CameraManager::Private::addCamera(std::shared_ptr<Camera> camera)
>   
>   		for (const std::shared_ptr<Camera> &c : cameras_) {
>   			if (c->id() == camera->id()) {
> -				LOG(Camera, Fatal)
> +				LOG(Camera, Error)
>   					<< "Trying to register a camera with a duplicated ID '"
>   					<< camera->id() << "'";
>   				return;

Patch
diff mbox series

diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 0dd4e0c590a1..9c9073053710 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -210,7 +210,7 @@  void CameraManager::Private::addCamera(std::shared_ptr<Camera> camera)
 
 		for (const std::shared_ptr<Camera> &c : cameras_) {
 			if (c->id() == camera->id()) {
-				LOG(Camera, Fatal)
+				LOG(Camera, Error)
 					<< "Trying to register a camera with a duplicated ID '"
 					<< camera->id() << "'";
 				return;