All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helen Koike <helen.koike@collabora.com>
To: Ezequiel Garcia <ezequiel@collabora.com>, linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>, kernel@collabora.com
Subject: Re: [PATCH] v4l2-core: Print control name in VIDIOC_S/G_(EXT)_CTRL(S)
Date: Thu, 11 Jun 2020 09:35:14 -0300	[thread overview]
Message-ID: <c47394e6-4f47-f212-1996-1960663ecfb6@collabora.com> (raw)
In-Reply-To: <20200609121514.9414-1-ezequiel@collabora.com>



On 6/9/20 9:15 AM, Ezequiel Garcia wrote:
> While debugging, it's currently really hard to identify controls
> by their ID. Print the control name making the print more helpful.
> 
> With this change, the print changes from:
> 
> video1: VIDIOC_S_EXT_CTRLS: which=0xf010000, count=5, error_idx=4, request_fd=45, id/size=0x990ce8/1048, id/size=0x990ce9/12, id/size=0x990cea/480, id/size=0x990ceb/896, id/size=0x990cec/400
> 
> to:
> 
> video1: VIDIOC_S_EXT_CTRLS: which=0xf010000, count=5, error_idx=4, request_fd=42, name=H264 Sequence Parameter Set, id/size=0x990ce8/1048, name=H264 Picture Parameter Set, id/size=0x990ce9/12, name=H264 Scaling Matrix, id/size=0x990cea/480, name=H264 Slice Parameters, id/size=0x990ceb/896, name=H264 Decode Parameters, id/size=0x990cec/400
> 
> For instance, this is specially helpful when the ioctl fails. Consider
> the following example:
> 
> v4l2-ctrls: prepare_ext_ctrls: video1: pointer control id 0x990cec size too small, 400 bytes but 784 bytes needed
> v4l2-ctrls: try_set_ext_ctrls: video1: video1: try_set_ext_ctrls_common failed (-14)
> video1: VIDIOC_S_EXT_CTRLS: error -14: which=0xf010000, count=5, error_idx=5, request_fd=39, name=H264 Sequence Parameter Set, id/size=0x990ce8/1048, name=H264 Picture Parameter Set, id/size=0x990ce9/12, name=H264 Scaling Matrix, id/size=0x990cea/480, name=H264 Slice Parameters, id/size=0x990ceb/896, name=H264 Decode Parameters, id/size=0x990cec/400
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>

Thanks Ezequiel,

I'll include this in the next RFC.

Regards,
Helen

> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 2322f08a98be..4264ac44c48b 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -582,8 +582,10 @@ static void v4l_print_querymenu(const void *arg, bool write_only)
>  static void v4l_print_control(const void *arg, bool write_only)
>  {
>  	const struct v4l2_control *p = arg;
> +	const char *name = v4l2_ctrl_get_name(p->id);
>  
> -	pr_cont("id=0x%x, value=%d\n", p->id, p->value);
> +	pr_cont("name=%s, id=0x%x, value=%d\n",
> +		name ? name : "unknown", p->id, p->value);
>  }
>  
>  static void v4l_print_ext_controls(const void *arg, bool write_only)
> @@ -594,12 +596,16 @@ static void v4l_print_ext_controls(const void *arg, bool write_only)
>  	pr_cont("which=0x%x, count=%d, error_idx=%d, request_fd=%d",
>  			p->which, p->count, p->error_idx, p->request_fd);
>  	for (i = 0; i < p->count; i++) {
> +		unsigned int id = p->controls[i].id;
> +		const char *name = v4l2_ctrl_get_name(id);
> +
> +		name = name ? name : "unknown";
>  		if (!p->controls[i].size)
> -			pr_cont(", id/val=0x%x/0x%x",
> -				p->controls[i].id, p->controls[i].value);
> +			pr_cont(", name=%s, id/val=0x%x/0x%x",
> +				name, id, p->controls[i].value);
>  		else
> -			pr_cont(", id/size=0x%x/%u",
> -				p->controls[i].id, p->controls[i].size);
> +			pr_cont(", name=%s, id/size=0x%x/%u",
> +				name, id, p->controls[i].size);
>  	}
>  	pr_cont("\n");
>  }
> 

  reply	other threads:[~2020-06-11 12:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 12:15 [PATCH] v4l2-core: Print control name in VIDIOC_S/G_(EXT)_CTRL(S) Ezequiel Garcia
2020-06-11 12:35 ` Helen Koike [this message]
2020-06-11 14:29   ` Helen Koike
2020-06-23 11:01 ` Hans Verkuil
2020-06-23 12:32   ` Ezequiel Garcia
2020-07-01 13:17 ` [PATCH v2] " Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c47394e6-4f47-f212-1996-1960663ecfb6@collabora.com \
    --to=helen.koike@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.