* [PATCH] v4l2-ctl: Add --get/--set-ctrl support for INTEGER and INTEGER64 arrays
@ 2023-05-25 13:35 Daniel Lundberg Pedersen
2023-08-15 14:34 ` Daniel Lundberg Pedersen
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Lundberg Pedersen @ 2023-05-25 13:35 UTC (permalink / raw)
To: linux-media; +Cc: Daniel Lundberg Pedersen
Add support for INTEGER and INTEGER64 arrays.
Also print error if trying to print unkown array type
Signed-off-by: Daniel Lundberg Pedersen <dlp@qtec.com>
---
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@qtec.com/
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] v4l2-ctl: Add --get/--set-ctrl support for INTEGER and INTEGER64 arrays
2023-05-25 13:35 [PATCH] v4l2-ctl: Add --get/--set-ctrl support for INTEGER and INTEGER64 arrays Daniel Lundberg Pedersen
@ 2023-08-15 14:34 ` Daniel Lundberg Pedersen
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lundberg Pedersen @ 2023-08-15 14:34 UTC (permalink / raw)
To: linux-media, Hans Verkuil
Hi
Gentle ping Hans
Regards Daniel
On 25/05/2023 15:35, Daniel Lundberg Pedersen wrote:
> Add support for INTEGER and INTEGER64 arrays.
>
> Also print error if trying to print unkown array type
>
> Signed-off-by: Daniel Lundberg Pedersen <dlp@qtec.com>
> ---
> 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@qtec.com/
>
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-15 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 13:35 [PATCH] v4l2-ctl: Add --get/--set-ctrl support for INTEGER and INTEGER64 arrays Daniel Lundberg Pedersen
2023-08-15 14:34 ` Daniel Lundberg Pedersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).