diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2021-03-22 13:21:54 +0100 |
---|---|---|
committer | Hans Verkuil <hans.verkuil@cisco.com> | 2021-03-22 13:21:54 +0100 |
commit | cb41b2a086cd045de319ec2686a7253037384711 (patch) | |
tree | 807223b356c2a1e34248a5e4c2529b5f58db99c9 | |
parent | 6e2fdceac7cbaf9ae9d9b01e8a8f4b6f949262ae (diff) | |
download | v4l-utils-cb41b2a086cd045de319ec2686a7253037384711.tar.gz |
v4l2-ctl: don't squash setting multiple identical controls.
This:
v4l2-ctl -c auto_exposure=3,exposure_time_absolute=100,auto_exposure=1,exposure_time_absolute=200
should turn into a single VIDIOC_S_EXT_CTRLS call with 4 controls instead
of 2 controls with just the last value for each control.
This helps testing VIDIOC_S_EXT_CTRLS to check if drivers handle this
correctly (only the last value for each control should be used).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r-- | utils/v4l2-ctl/v4l2-ctl-common.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index 4207c6d8..7d0d5c90 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -35,8 +35,9 @@ static ctrl_subset_map ctrl_subsets; using ctrl_get_list = std::list<std::string>; static ctrl_get_list get_ctrls; -using ctrl_set_map = std::map<std::string, std::string>; -static ctrl_set_map set_ctrls; +using ctrl_set_pair = std::pair<std::string, std::string>; +using ctrl_set_list = std::list<ctrl_set_pair>; +static ctrl_set_list set_ctrls; using dev_vec = std::vector<std::string>; using dev_map = std::map<std::string, std::string>; @@ -956,7 +957,8 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) std::exit(EXIT_FAILURE); } if (const char *equal = std::strchr(value, '=')) { - set_ctrls[std::string(value, (equal - value))] = equal + 1; + set_ctrls.push_back(std::make_pair(std::string(value, (equal - value)), + std::string(equal + 1))); } else { fprintf(stderr, "control '%s' without '='\n", value); |