[RFC,3/5] v4l2-ctl: use a dedicated function to print the control class name

Message ID 20190103180102.12282-4-ao2@ao2.it (mailing list archive)
State Changes Requested, archived
Delegated to: Hans Verkuil
Headers

Commit Message

Antonio Ospite Jan. 3, 2019, 6:01 p.m. UTC
  All the details about the controls are printed in the dedicated function
print_qctrl(), use a new dedicated function named print_class_name() to
print the control class name as well, this is for symmetry but it is
also in preparation for a change which aims to abstract how the controls
are printed.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
---
 utils/v4l2-ctl/v4l2-ctl-common.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Patch

diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index e2710335..5d41d720 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -403,6 +403,11 @@  static void print_qctrl(int fd, struct v4l2_query_ext_ctrl *queryctrl,
 	}
 }
 
+static void print_class_name(const char *name)
+{
+	printf("\n%s\n\n", name);
+}
+
 static int print_control(int fd, struct v4l2_query_ext_ctrl &qctrl, int show_menus)
 {
 	struct v4l2_control ctrl;
@@ -415,7 +420,7 @@  static int print_control(int fd, struct v4l2_query_ext_ctrl &qctrl, int show_men
 	if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
 		return 1;
 	if (qctrl.type == V4L2_CTRL_TYPE_CTRL_CLASS) {
-		printf("\n%s\n\n", qctrl.name);
+		print_class_name(qctrl.name);
 		return 1;
 	}
 	ext_ctrl.id = qctrl.id;