Commit 01f6101c authored by Hans Verkuil's avatar Hans Verkuil Committed by Kamal Mostafa

[media] v4l2-ctrls: arrays are also considered compound controls

commit 35204e2e upstream.

Array controls weren't skipped when only V4L2_CTRL_FLAG_NEXT_CTRL was
provided (so no V4L2_CTRL_FLAG_NEXT_COMPOUND was set). This is wrong
since arrays are also considered compound controls (i.e. with more than
one value), and applications that do not know about arrays will not
be able to handle such controls.

Fix the test to include arrays.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Reported-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 1b98249e
...@@ -2513,7 +2513,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr ...@@ -2513,7 +2513,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
/* We found a control with the given ID, so just get /* We found a control with the given ID, so just get
the next valid one in the list. */ the next valid one in the list. */
list_for_each_entry_continue(ref, &hdl->ctrl_refs, node) { list_for_each_entry_continue(ref, &hdl->ctrl_refs, node) {
is_compound = is_compound = ref->ctrl->is_array ||
ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES; ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
if (id < ref->ctrl->id && if (id < ref->ctrl->id &&
(is_compound & mask) == match) (is_compound & mask) == match)
...@@ -2527,7 +2527,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr ...@@ -2527,7 +2527,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
is one, otherwise the first 'if' above would have is one, otherwise the first 'if' above would have
been true. */ been true. */
list_for_each_entry(ref, &hdl->ctrl_refs, node) { list_for_each_entry(ref, &hdl->ctrl_refs, node) {
is_compound = is_compound = ref->ctrl->is_array ||
ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES; ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
if (id < ref->ctrl->id && if (id < ref->ctrl->id &&
(is_compound & mask) == match) (is_compound & mask) == match)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment