apps: cam: Print control direction information

Now that there is support for retrieving the allowed directions of a
control, print this information when listing controls.

Sample output:
$ cam --list-controls -c 2
Using camera Virtual0 as cam0
Control: [inout] draft::FaceDetectMode:
  - FaceDetectModeOff (0)
Control: [inout] libcamera::FrameDurationLimits: [16666..33333]
   Size: 2

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder 2024-11-26 00:18:36 +09:00
parent 34d7b4776b
commit 936a099eca

View file

@ -159,12 +159,18 @@ CameraSession::~CameraSession()
void CameraSession::listControls() const
{
for (const auto &[id, info] : camera_->controls()) {
std::stringstream io;
io << "["
<< (id->isInput() ? "in" : " ")
<< (id->isOutput() ? "out" : " ")
<< "] ";
if (info.values().empty()) {
std::cout << "Control: "
std::cout << "Control: " << io.str()
<< id->vendor() << "::" << id->name() << ": "
<< info.toString() << std::endl;
} else {
std::cout << "Control: "
std::cout << "Control: " << io.str()
<< id->vendor() << "::" << id->name() << ":"
<< std::endl;
for (const auto &value : info.values()) {