[libcamera-devel] libcamera: v4l2_device: Print control ID in unknown type log messagge

Message ID 20191015140207.8227-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 876b90086215ce933ceb7f2822ba9a9688e07c14
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_device: Print control ID in unknown type log messagge
Related show

Commit Message

Laurent Pinchart Oct. 15, 2019, 2:02 p.m. UTC
When the type of a control enumerated from a V4L2 device is not
supported, we log a debug message that mentions the control type. This
makes it hard to figure out which control is faulty. Print the control
ID instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_device.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund Oct. 15, 2019, 2:42 p.m. UTC | #1
Hi Laurent,

Thanks for breaking this out.

On 2019-10-15 17:02:07 +0300, Laurent Pinchart wrote:
> When the type of a control enumerated from a V4L2 device is not
> supported, we log a debug message that mentions the control type. This
> makes it hard to figure out which control is faulty. Print the control
> ID instead.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/v4l2_device.cpp | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index b47ba448f354..68f2d44d11f4 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -8,11 +8,13 @@
>  #include "v4l2_device.h"
>  
>  #include <fcntl.h>
> +#include <iomanip>
>  #include <string.h>
>  #include <sys/ioctl.h>
>  #include <unistd.h>
>  
>  #include "log.h"
> +#include "utils.h"
>  #include "v4l2_controls.h"
>  
>  /**
> @@ -371,8 +373,9 @@ void V4L2Device::listControls()
>  			break;
>  		/* \todo Support compound controls. */
>  		default:
> -			LOG(V4L2, Debug) << "Control type '" << ctrl.type
> -					 << "' not supported";
> +			LOG(V4L2, Debug)
> +				<< "Control " << utils::hex(ctrl.id)
> +				<< " has unsupported type " << ctrl.type;
>  			continue;
>  		}
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index b47ba448f354..68f2d44d11f4 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -8,11 +8,13 @@ 
 #include "v4l2_device.h"
 
 #include <fcntl.h>
+#include <iomanip>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 
 #include "log.h"
+#include "utils.h"
 #include "v4l2_controls.h"
 
 /**
@@ -371,8 +373,9 @@  void V4L2Device::listControls()
 			break;
 		/* \todo Support compound controls. */
 		default:
-			LOG(V4L2, Debug) << "Control type '" << ctrl.type
-					 << "' not supported";
+			LOG(V4L2, Debug)
+				<< "Control " << utils::hex(ctrl.id)
+				<< " has unsupported type " << ctrl.type;
 			continue;
 		}