aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2021-11-09 13:26:25 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-11-09 13:37:17 +0100
commite401b3aebdaa6241cfe06d5d4ccebcb487f6b3e3 (patch)
tree94d5b139165c3f5eb17a6f09fc744d57bc02075d
parentce2d59cf21eed7012a848e72b1db18c6a5c11490 (diff)
downloadv4l-utils-e401b3aebdaa6241cfe06d5d4ccebcb487f6b3e3.tar.gz
v4l2-ctl: pass bus_info to mi_get_media_fd()
If there are multiple instances of vivid, then mi_get_media_fd() needs to find the media device corresponding to the bus_info of the video device, and not just return the first media device it finds in /dev. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 7e24e0ec..752ea140 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1258,7 +1258,9 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
return QUEUE_STOPPED;
if (fmt.g_pixelformat() == V4L2_PIX_FMT_FWHT_STATELESS) {
- int media_fd = mi_get_media_fd(fd.g_fd());
+ struct v4l2_capability vcap = {};
+ fd.querycap(vcap);
+ int media_fd = mi_get_media_fd(fd.g_fd(), (const char *)vcap.bus_info);
if (media_fd < 0) {
fprintf(stderr, "%s: mi_get_media_fd failed\n", __func__);
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index 95b8a2e7..d7f8fe23 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -1351,7 +1351,7 @@ int main(int argc, char **argv)
capabilities = vcap.device_caps;
}
- media_fd = mi_get_media_fd(fd);
+ media_fd = mi_get_media_fd(fd, is_subdev ? 0 : (const char *)vcap.bus_info);
priv_magic = (capabilities & V4L2_CAP_EXT_PIX_FORMAT) ?
V4L2_PIX_FMT_PRIV_MAGIC : 0;