[libcamera-devel] [PATCH] libcamera: media_device: Print link information when setup fails

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Oct 12 03:09:32 CEST 2021


When setting up a link fails, the error message doesn't specify which
link is being acted on. This makes debugging more difficult than it
should be. Improve the message by printing the link information.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/libcamera/media_device.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index ccaf039ba7a9..aa93da75c593 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -803,7 +803,11 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)
 	if (ret) {
 		ret = -errno;
 		LOG(MediaDevice, Error)
-			<< "Failed to setup link: "
+			<< "Failed to setup link "
+			<< source->entity()->name() << "["
+			<< source->index() << "] -> "
+			<< sink->entity()->name() << "["
+			<< sink->index() << "]: "
 			<< strerror(-ret);
 		return ret;
 	}

base-commit: fa7a95bf32c6a8ee87b67159d4238cbc8e6dc3a9
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list