diff mbox

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

Message ID 1309944280-11936-1-git-send-email-t.stanislaws@samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Tomasz Stanislawski July 6, 2011, 9:24 a.m. UTC
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@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 utils/v4l2-ctl/v4l2-ctl.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Hans Verkuil July 6, 2011, 9:45 a.m. UTC | #1
> 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.

This is already fixed in the latest version. I found the same
bug recently.

Regards,

      Hans

>
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


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

Patch

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