[2/2] libcamera: pipeline: virtual: Demote config file error message to debug
diff mbox series

Message ID 20250110023920.28502-2-laurent.pinchart@ideasonboard.com
State Accepted
Commit 6841ea8d3694c76911bb2b346753134ae3a5091b
Headers show
Series
  • [1/2] libcamera: pipeline_handler: Enable silent configuration file lookup
Related show

Commit Message

Laurent Pinchart Jan. 10, 2025, 2:39 a.m. UTC
The virtual pipeline handler prints an error message when its
configuration file can't be opened. Not providing a configuration file
is the default method to disable virtual cameras, so this error is
confusing for users. Replace it with a debug message when the
configuration file is not found, and keep an error message when it
exists but can't be opened.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/virtual/virtual.cpp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
index e692a5433dde8cd5..469f56556f5eb40d 100644
--- a/src/libcamera/pipeline/virtual/virtual.cpp
+++ b/src/libcamera/pipeline/virtual/virtual.cpp
@@ -329,10 +329,17 @@  bool PipelineHandlerVirtual::match([[maybe_unused]] DeviceEnumerator *enumerator
 
 	created_ = true;
 
-	File file(configurationFile("virtual", "virtual.yaml"));
-	bool isOpen = file.open(File::OpenModeFlag::ReadOnly);
-	if (!isOpen) {
-		LOG(Virtual, Error) << "Failed to open config file: " << file.fileName();
+	std::string configFile = configurationFile("virtual", "virtual.yaml", true);
+	if (configFile.empty()) {
+		LOG(Virtual, Debug)
+			<< "Configuration file not found, skipping virtual cameras";
+		return false;
+	}
+
+	File file(configFile);
+	if (!file.open(File::OpenModeFlag::ReadOnly)) {
+		LOG(Virtual, Error)
+			<< "Failed to open config file `" << file.fileName() << "`";
 		return false;
 	}