[RFC,2/5] v4l2-ctl: list once when both OptListCtrls and OptListCtrlsMenus are there
Commit Message
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(-)
@@ -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]);
}
}