summaryrefslogtreecommitdiff
path: root/src/apps/cam
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2024-09-16 01:24:19 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-09-25 23:54:14 +0300
commitab48009a81c929d37d236554ca0914b9a8994a4a (patch)
tree2299cabbe2bc446cc6ab1ff0a5545d5de8fed725 /src/apps/cam
parent9bbccb97fa0debc86d906fdfc1fbedbd50de5d06 (diff)
apps: cam: Print control enum values more nicely
Now that enum names can be obtained from ControlId, use that information to print out the list of supported enum values in --list-controls. Example output (with a dummy AwbMode ControlInfo added to vimc): $ cam -c 1 --list-controls Using camera platform/vimc.0 Sensor B as cam0 Control: AwbMode: - AwbTungsten (2) - AwbFluorescent (3) - AwbDaylight (5) Control: Brightness: [-1.000000..1.000000] Control: Contrast: [0.000000..2.000000] Control: Saturation: [0.000000..2.000000] Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/apps/cam')
-rw-r--r--src/apps/cam/camera_session.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
index 097dc479..fc092380 100644
--- a/src/apps/cam/camera_session.cpp
+++ b/src/apps/cam/camera_session.cpp
@@ -159,8 +159,23 @@ CameraSession::~CameraSession()
void CameraSession::listControls() const
{
for (const auto &[id, info] : camera_->controls()) {
- std::cout << "Control: " << id->name() << ": "
- << info.toString() << std::endl;
+ if (info.values().empty()) {
+ std::cout << "Control: " << id->name() << ": "
+ << info.toString() << std::endl;
+ } else {
+ std::cout << "Control: " << id->name() << ":" << std::endl;
+ for (const auto &value : info.values()) {
+ int32_t val = value.get<int32_t>();
+ const auto &it = id->enumerators().find(val);
+
+ std::cout << " - ";
+ if (it == id->enumerators().end())
+ std::cout << "UNKNOWN";
+ else
+ std::cout << it->second;
+ std::cout << " (" << val << ")" << std::endl;
+ }
+ }
}
}