v4l2-core: Print control name in VIDIOC_S/G_(EXT)_CTRL(S)
PATCH 1/1 v4l2-core: Print control name in VIDIOC_S/G_(EXT)_CTRL(S)
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
--- drivers/media/v4l2-core/v4l2-ioctl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +11 -5
@@ -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" ); }
Signature · 1 line
2.26.0.rc2
Quoted 11 lines · Ezequiel Garcia
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/400to:
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
Quoted 8 lines
For instance, this is specially helpful when the ioctl fails. Consider the following example:
v4l2-ctrls:
prepare_ext_ctrls: video1: pointer control id0x990cecsize too small, 400 bytes but 784 bytes needed
v4l2-ctrls:try_set_ext_ctrls: video1: video1:try_set_ext_ctrls_commonfailed (-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/400Signed-off-by Ezequiel Garcia <[email protected]>
Thanks Ezequiel,
I'll include this in the next RFC.
Regards,
Helen
Quoted 42 lines
--- drivers/media/v4l2-core/v4l2-ioctl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +11
-5@@ -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" ); }
Quoted 21 lines · Helen Koike
Quoted 18 lines · Ezequiel Garcia
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/400to:
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/400For instance, this is specially helpful when the ioctl fails. Consider the following example:
v4l2-ctrls:
prepare_ext_ctrls: video1: pointer control id0x990cecsize too small, 400 bytes but 784 bytes needed
v4l2-ctrls:try_set_ext_ctrls: video1: video1:try_set_ext_ctrls_commonfailed (-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
Quoted 5 lines
Quoted 1 line
Signed-off-by Ezequiel Garcia <[email protected]>Thanks Ezequiel,
I'll include this in the next RFC.
Please ignore my last email, I made a mistake/confusion.
Regards,
Helen
Quoted 46 lines
Regards,
HelenQuoted 42 lines
--- drivers/media/v4l2-core/v4l2-ioctl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +11
-5@@ -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" ); }
Quoted 28 lines · Ezequiel Garcia
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/400to:
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/400For instance, this is specially helpful when the ioctl fails. Consider the following example:
v4l2-ctrls:
prepare_ext_ctrls: video1: pointer control id0x990cecsize too small, 400 bytes but 784 bytes needed
v4l2-ctrls:try_set_ext_ctrls: video1: video1:try_set_ext_ctrls_commonfailed (-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/400Signed-off-by Ezequiel Garcia <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_print_querymenu(const void *arg, bool write_only) · line 588
Quoted 8 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-1@@ -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);
I prefer:
if (name)
pr_cont("name=%s, ", name);
pr_cont("id=0x%x, value=%d\n", p->id, p->value);Quoted 11 lines
drivers/media/v4l2-core/v4l2-ioctl.c +4
-0}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" ;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_print_ext_controls(const void *arg, bool write_only) · line 608
Quoted 10 lines
drivers/media/v4l2-core/v4l2-ioctl.c +4
-4if (!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);
Same here.
Regards,
Hans
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0}pr_cont ("\n" ); }
Quoted 45 lines · Hans Verkuil
Quoted 33 lines · Ezequiel Garcia
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/400to:
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/400For instance, this is specially helpful when the ioctl fails. Consider the following example:
v4l2-ctrls:
prepare_ext_ctrls: video1: pointer control id0x990cecsize too small, 400 bytes but 784 bytes needed
v4l2-ctrls:try_set_ext_ctrls: video1: video1:try_set_ext_ctrls_commonfailed (-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/400Signed-off-by Ezequiel Garcia <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_print_querymenu(const void *arg, bool write_only) · line 588
Quoted 8 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-1@@ -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);I prefer:
Quoted 4 lines
if (name)
pr_cont("name=%s, ", name);
pr_cont("id=0x%x, value=%d\n", p->id, p->value);I don't have issues posting a v2 with that if you prefer.
However, seems to me seeing "unknown" if the name wasn't found is actually a good debugging hint, signalling the control ID is probably wrong.
Thanks for reviewing,
Ezequiel
PATCH v2 1/1 v4l2-core: Print control name in VIDIOC_S/G_(EXT)_CTRL(S)
In reply to Ezequiel GarciaWhile 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
---
v2:
* As requested by Hans, only print the name if non-null.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +10 -4
@@ -582,7 +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); +if (name) +pr_cont ("name=%s, " , name);pr_cont ("id=0x%x, value=%d\n" , p->id, p->value); }
@@ -594,12 +597,15 @@ 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); + +if (name) +pr_cont (", name=%s" , name);if (!p->controls[i].size) -pr_cont (", id/val=0x%x/0x%x" , - p->controls[i].id, p->controls[i].value); +pr_cont (", id/val=0x%x/0x%x" , id, p->controls[i].value);else -pr_cont (", id/size=0x%x/%u" , - p->controls[i].id, p->controls[i].size); +pr_cont (", id/size=0x%x/%u" , id, p->controls[i].size); }pr_cont ("\n" ); }
Signature · 1 line
2.26.0.rc2