[v3,1/3] libcamera: simple: Log a missing sensor in a better way
diff mbox series

Message ID 20240731183616.1977348-2-mzamazal@redhat.com
State Accepted
Commit 06674004fb754afded78125aabc642dbf6ff9c84
Headers show
Series
  • Fix misleading error messages
Related show

Commit Message

Milan Zamazal July 31, 2024, 6:36 p.m. UTC
SimplePipelineHandler::match may be called several times for different
pipeline configurations.  Not all of these calls must succeed.  For
example, for TI AM69 board with a single camera attached, the following
error is reported in the log even when libcamera works fine:

  ERROR SimplePipeline simple.cpp:1558 No sensor found

This is because a sensor is found for /dev/media0 but not for
/dev/media1.  The error is harmless in such a case and only confuses
users who may think no camera is detected at all.  Let's change the
error to info and add the device node to the message to indicate the
error is specific to the given media only.  It's up to the callers to
report a fatal error condition if libcamera cannot work due to no
matching pipeline configuration.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index c050966a..9910900e 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -1547,10 +1547,12 @@  bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
 	/* Locate the sensors. */
 	std::vector<MediaEntity *> sensors = locateSensors();
 	if (sensors.empty()) {
-		LOG(SimplePipeline, Error) << "No sensor found";
+		LOG(SimplePipeline, Info) << "No sensor found for " << media_->deviceNode();
 		return false;
 	}
 
+	LOG(SimplePipeline, Debug) << "Sensor found for " << media_->deviceNode();
+
 	/*
 	 * Create one camera data instance for each sensor and gather all
 	 * entities in all pipelines.