[2/3] apps: cam: Print control vendor information when listing controls
diff mbox series

Message ID 20241010084719.712485-3-paul.elder@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: controls: Add namespace to ControlId
Related show

Commit Message

Paul Elder Oct. 10, 2024, 8:47 a.m. UTC
Now that the vendor of the control can be queried, print it in
--list-controls.

Example output:
$ cam -c 1 --list-controls
Using camera platform/vimc.0 Sensor B as cam0
Control: libcamera::Brightness: [-1.000000..1.000000]
Control: libcamera::Contrast: [0.000000..2.000000]
Control: libcamera::Saturation: [0.000000..2.000000]

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/apps/cam/camera_session.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Oct. 10, 2024, 8:44 p.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Thu, Oct 10, 2024 at 05:47:18PM +0900, Paul Elder wrote:
> Now that the vendor of the control can be queried, print it in
> --list-controls.
> 
> Example output:
> $ cam -c 1 --list-controls
> Using camera platform/vimc.0 Sensor B as cam0
> Control: libcamera::Brightness: [-1.000000..1.000000]
> Control: libcamera::Contrast: [0.000000..2.000000]
> Control: libcamera::Saturation: [0.000000..2.000000]

I wonder if we should rename libcamera to core at some point.

> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/apps/cam/camera_session.cpp | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
> index edc49b875450..6e9890ccfda1 100644
> --- a/src/apps/cam/camera_session.cpp
> +++ b/src/apps/cam/camera_session.cpp
> @@ -160,10 +160,13 @@ void CameraSession::listControls() const
>  {
>  	for (const auto &[id, info] : camera_->controls()) {
>  		if (info.values().empty()) {
> -			std::cout << "Control: " << id->name() << ": "
> +			std::cout << "Control: "
> +				  << id->vendor() << "::" << id->name() << ": "
>  				  << info.toString() << std::endl;
>  		} else {
> -			std::cout << "Control: " << id->name() << ":" << std::endl;
> +			std::cout << "Control: "
> +				  << id->vendor() << "::" << id->name() << ":"
> +				  << std::endl;
>  			for (const auto &value : info.values()) {
>  				int32_t val = value.get<int32_t>();
>  				const auto &it = id->enumerators().find(val);

Patch
diff mbox series

diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
index edc49b875450..6e9890ccfda1 100644
--- a/src/apps/cam/camera_session.cpp
+++ b/src/apps/cam/camera_session.cpp
@@ -160,10 +160,13 @@  void CameraSession::listControls() const
 {
 	for (const auto &[id, info] : camera_->controls()) {
 		if (info.values().empty()) {
-			std::cout << "Control: " << id->name() << ": "
+			std::cout << "Control: "
+				  << id->vendor() << "::" << id->name() << ": "
 				  << info.toString() << std::endl;
 		} else {
-			std::cout << "Control: " << id->name() << ":" << std::endl;
+			std::cout << "Control: "
+				  << id->vendor() << "::" << id->name() << ":"
+				  << std::endl;
 			for (const auto &value : info.values()) {
 				int32_t val = value.get<int32_t>();
 				const auto &it = id->enumerators().find(val);