Add support for INTEGER and INTEGER64 arrays. Also print error if trying to print unkown array type Signed-off-by: Daniel Lundberg Pedersen <dlp@xxxxxxxx> --- NOTE: This patch depends on the fixed pointer types for p_s32 and p_s64 from this patch: https://lore.kernel.org/linux-media/20230501145707.4088026-2-dlp@xxxxxxxx/ utils/v4l2-ctl/v4l2-ctl-common.cpp | 34 +++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index a1cc93c825c8..d753f64d8e30 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -472,6 +472,26 @@ static void print_array(const v4l2_query_ext_ctrl &qc, const v4l2_ext_control &c } printf("\n"); break; + case V4L2_CTRL_TYPE_INTEGER: + for (i = from; i <= to; i++) { + printf("%10i", ctrl.p_s32[idx + i]); + if (i < to) + printf(", "); + } + printf("\n"); + break; + case V4L2_CTRL_TYPE_INTEGER64: + for (i = from; i <= to; i++) { + printf("%12lli", ctrl.p_s64[idx + i]); + if (i < to) + printf(", "); + } + printf("\n"); + break; + default: + fprintf(stderr, "%s: unsupported array type\n", + qc.name); + break; } } } @@ -1149,6 +1169,18 @@ void common_set(cv4l_fd &_fd) if (idx_in_subset(qc, subset, divide, i)) ctrl.p_u32[i] = v; break; + case V4L2_CTRL_TYPE_INTEGER: + v = strtol(set_ctrl.second.c_str(), nullptr, 0); + for (i = 0; i < qc.elems; i++) + if (idx_in_subset(qc, subset, divide, i)) + ctrl.p_s32[i] = v; + break; + case V4L2_CTRL_TYPE_INTEGER64: + v = strtol(set_ctrl.second.c_str(), nullptr, 0); + for (i = 0; i < qc.elems; i++) + if (idx_in_subset(qc, subset, divide, i)) + ctrl.p_s64[i] = v; + break; case V4L2_CTRL_TYPE_STRING: strncpy(ctrl.string, set_ctrl.second.c_str(), qc.maximum); ctrl.string[qc.maximum] = 0; -- 2.38.5