[libcamera-devel] libcamera: media_device: Print link information when setup fails
diff mbox series

Message ID 20211012010932.15873-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 211d6f5ca6adfa5d90a73e753d17478123ba887f
Headers show
Series
  • [libcamera-devel] libcamera: media_device: Print link information when setup fails
Related show

Commit Message

Laurent Pinchart Oct. 12, 2021, 1:09 a.m. UTC
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@ideasonboard.com>
---
 src/libcamera/media_device.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)


base-commit: fa7a95bf32c6a8ee87b67159d4238cbc8e6dc3a9

Comments

Kieran Bingham Oct. 12, 2021, 11:19 a.m. UTC | #1
Quoting Laurent Pinchart (2021-10-12 02:09:32)
> 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.
> 

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@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
>

Patch
diff mbox series

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;
 	}