[PATCH 2/2] v4l2-ctl: fix wrapped open/close

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When running in libv4l2 warp mode, the application did not use
v4l2_open and v4l2_close in some cases. This patch fixes this
issue substituting open/close calls with test_open/test_close
which are libv4l2-aware.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 utils/v4l2-ctl/v4l2-ctl.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index 227ce1a..02f97e4 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -1604,13 +1604,13 @@ static void list_devices()
 
 	for (dev_vec::iterator iter = files.begin();
 			iter != files.end(); ++iter) {
-		int fd = open(iter->c_str(), O_RDWR);
+		int fd = test_open(iter->c_str(), O_RDWR);
 		std::string bus_info;
 
 		if (fd < 0)
 			continue;
 		doioctl(fd, VIDIOC_QUERYCAP, &vcap);
-		close(fd);
+		test_close(fd);
 		bus_info = (const char *)vcap.bus_info;
 		if (cards[bus_info].empty())
 			cards[bus_info] += std::string((char *)vcap.card) + " (" + bus_info + "):\n";
@@ -2535,7 +2535,7 @@ int main(int argc, char **argv)
 		return 1;
 	}
 
-	if ((fd = open(device, O_RDWR)) < 0) {
+	if ((fd = test_open(device, O_RDWR)) < 0) {
 		fprintf(stderr, "Failed to open %s: %s\n", device,
 			strerror(errno));
 		exit(1);
@@ -3693,6 +3693,6 @@ int main(int argc, char **argv)
 			perror("VIDIOC_QUERYCAP");
 	}
 
-	close(fd);
+	test_close(fd);
 	exit(app_result);
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux