[libcamera-devel] [PATCH 10/10] DO NOT MERGE: Reports camera properties in cam

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Dec 4 17:35:16 CET 2019


Hi Jacopo,

Thank you for the patch.

On Wed, Dec 04, 2019 at 02:21:06PM +0100, Jacopo Mondi wrote:
> Running cam -l lists the camera properties registered by the pipeline
> handler.
> 
> In example, for the VIMC pipelinehandler:
> 
> Available cameras:
> 1: Integrated Camera: Integrated C
> 2: VIMC Sensor B
> Rotation: 0
> Location: 0

If you want to produce a mergeable patch, I think you could simply add a
new command line argument to print the properties. And you would need to
handle types, as the hardcoded int32_t below wouldn't be enough.

> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  src/cam/main.cpp | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/cam/main.cpp b/src/cam/main.cpp
> index a38cca959aca..8d37754773af 100644
> --- a/src/cam/main.cpp
> +++ b/src/cam/main.cpp
> @@ -11,6 +11,7 @@
>  #include <string.h>
>  
>  #include <libcamera/libcamera.h>
> +#include <libcamera/property_ids.h>
>  
>  #include "capture.h"
>  #include "event_loop.h"
> @@ -309,6 +310,16 @@ int CamApp::run()
>  		for (const std::shared_ptr<Camera> &cam : cm_->cameras()) {
>  			std::cout << index << ": " << cam->name() << std::endl;
>  			index++;
> +
> +			const ControlList &properties = cam->properties();
> +			for (const auto &prop : properties) {
> +				auto it = properties::properties.find(prop.first);
> +				if (it == properties::properties.end())
> +					continue;
> +
> +				std::cout << it->second->name() << ": " <<
> +					prop.second.get<int32_t>() << "\n";
> +			}
>  		}
>  	}
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list