[libcamera-devel] [PATCH v3 13/22] libcamera: pipeline_handler: Fatal if registering camera without media devices

Paul Elder paul.elder at ideasonboard.com
Sat Jul 4 15:31:31 CEST 2020


Pipeline handlers must acquire media devices via
PipelineHander::acquireMediaDevice so that the media devices can be
registered with the pipeline handler, so that they can be automatically
added to the devnum map for the v4l2 compatibility layer to use. Die
fatally if any camera trying to be registered has not acquired any media
devices via acquireMediaDevice.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
No change in v3
---
 src/libcamera/pipeline_handler.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index de5ca09..8a6c9c2 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -496,6 +496,10 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,
 	cameraData_[camera.get()] = std::move(data);
 	cameras_.push_back(camera);
 
+	if (!mediaDevices_.size())
+		LOG(Pipeline, Fatal)
+			<< "Registering camera with no media devices!";
+
 	/*
 	 * Walk the entity list and map the devnums of all capture video nodes
 	 * to the camera.
-- 
2.27.0



More information about the libcamera-devel mailing list