@@ -99,6 +99,7 @@ void common_usage()
" -r, --subset <ctrl>[,<offset>,<size>]+\n"
" the subset of the N-dimensional array to get/set for control <ctrl>,\n"
" for every dimension an (<offset>, <size>) tuple is given.\n"
+ " --float report fixed-point control values as floating point\n"
#ifndef NO_LIBV4L2
" -w, --wrapper use the libv4l2 wrapper library.\n"
#endif
@@ -443,6 +444,11 @@ static void print_fp(__s64 v, unsigned int fraction_bits)
if (!f) {
printf("%lld", i);
+ } else if (options[OptFloat]) {
+ if (fraction_bits <= 16)
+ printf("%.8f", (double)v / (1ULL << fraction_bits));
+ else
+ printf("%.8g", (double)v / (1ULL << fraction_bits));
} else if (fraction_bits < 20) {
__u64 div = 1ULL << fraction_bits;
@@ -142,6 +142,7 @@ static struct option long_options[] = {
{"silent", no_argument, nullptr, OptSilent},
{"verbose", no_argument, nullptr, OptVerbose},
{"log-status", no_argument, nullptr, OptLogStatus},
+ {"float", no_argument, nullptr, OptFloat},
{"get-fmt-overlay", no_argument, nullptr, OptGetOverlayFormat},
{"set-fmt-overlay", optional_argument, nullptr, OptSetOverlayFormat},
{"try-fmt-overlay", optional_argument, nullptr, OptTryOverlayFormat},
@@ -142,6 +142,7 @@ enum Option {
OptLogStatus,
OptVerbose,
OptSilent,
+ OptFloat,
OptGetSlicedVbiCap,
OptGetSlicedVbiOutCap,
OptGetFBuf,
If given, report fixed point values as floating point values. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> --- utils/v4l2-ctl/v4l2-ctl-common.cpp | 6 ++++++ utils/v4l2-ctl/v4l2-ctl.cpp | 1 + utils/v4l2-ctl/v4l2-ctl.h | 1 + 3 files changed, 8 insertions(+)