diff mbox series

[RFC,2/5] v4l2-ctl: list once when both OptListCtrls and OptListCtrlsMenus are there

Message ID 20190103180102.12282-3-ao2@ao2.it (mailing list archive)
State New, archived
Headers show
Series v4l2-ctl: list controls values in a machine-readable format | expand

Commit Message

Antonio Ospite Jan. 3, 2019, 6 p.m. UTC
When both --list-ctrls and --list-ctrls-menus are passed, controls are
listed twice which is accurate but can be confusing.

Treat --list-ctrls-menus as an option modifier when also --list-ctrls is
passed, in order to have the controls listed only once.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
---
 utils/v4l2-ctl/v4l2-ctl-common.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 8256cbd9..e2710335 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -1091,11 +1091,7 @@  void common_get(cv4l_fd &_fd)
 
 void common_list(cv4l_fd &fd)
 {
-	if (options[OptListCtrlsMenus]) {
-		list_controls(fd.g_fd(), 1);
-	}
-
-	if (options[OptListCtrls]) {
-		list_controls(fd.g_fd(), 0);
+	if (options[OptListCtrls] || options[OptListCtrlsMenus]) {
+		list_controls(fd.g_fd(), options[OptListCtrlsMenus]);
 	}
 }