mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
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>
This commit is contained in:
parent
9bbccb97fa
commit
ab48009a81
1 changed files with 17 additions and 2 deletions
|
@ -159,8 +159,23 @@ CameraSession::~CameraSession()
|
|||
void CameraSession::listControls() const
|
||||
{
|
||||
for (const auto &[id, info] : camera_->controls()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue