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 <a...@ao2.it>
---
 utils/v4l2-ctl/v4l2-ctl-common.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

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]);
        }
 }
-- 
2.20.1

Reply via email to