[v2,2/2] apps: cam: Print control array sizes
diff mbox series

Message ID 20240911162400.1906661-3-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • Add array information to ControlId
Related show

Commit Message

Paul Elder Sept. 11, 2024, 4:24 p.m. UTC
Now that controls can be queried for array information, print it in
--list-controls when applicable.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

---
No change in v2
---
 src/apps/cam/camera_session.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Pinchart Sept. 11, 2024, 4:29 p.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Wed, Sep 11, 2024 at 06:24:00PM +0200, Paul Elder wrote:
> Now that controls can be queried for array information, print it in
> --list-controls when applicable.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> ---
> No change in v2
> ---
>  src/apps/cam/camera_session.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
> index 37de6c9f3..9c7f84993 100644
> --- a/src/apps/cam/camera_session.cpp
> +++ b/src/apps/cam/camera_session.cpp
> @@ -169,6 +169,11 @@ void CameraSession::listControls() const
>  				std::cout << "  - " << id->enumToString(val) << " (" << val << ")" << std::endl;
>  			}
>  		}
> +
> +		if (id->isArray()) {
> +			std::size_t size = id->size();
> +			std::cout << "   Size: " << (size == std::numeric_limits<std::size_t>::max() ? "n" : std::to_string(size)) << std::endl;

Too long. With that fixed,

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

> +		}
>  	}
>  }
>

Patch
diff mbox series

diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
index 37de6c9f3..9c7f84993 100644
--- a/src/apps/cam/camera_session.cpp
+++ b/src/apps/cam/camera_session.cpp
@@ -169,6 +169,11 @@  void CameraSession::listControls() const
 				std::cout << "  - " << id->enumToString(val) << " (" << val << ")" << std::endl;
 			}
 		}
+
+		if (id->isArray()) {
+			std::size_t size = id->size();
+			std::cout << "   Size: " << (size == std::numeric_limits<std::size_t>::max() ? "n" : std::to_string(size)) << std::endl;
+		}
 	}
 }