This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/v4l-utils.git tree:
Subject: v4l2-compliance: do the read/write tests in non-blocking mode. Author: Hans Verkuil <[email protected]> Date: Wed Sep 5 17:29:47 2012 +0200 Many devices will block when trying to read from it if e.g. there is no valid channel or video signal present. So do this test in non-blocking mode. Signed-off-by: Hans Verkuil <[email protected]> (cherry picked from commit 9619df722d7370a78c274b6dfad380744640f8a1) Signed-off-by: Gregor Jasny <[email protected]> utils/v4l2-compliance/v4l2-test-buffers.cpp | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=6d87371baaebb2ceedc97837b1d867c1b44ccbfd diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index e31e2fe..fec18a8 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -144,9 +144,11 @@ int testReqBufs(struct node *node) int testReadWrite(struct node *node) { bool can_rw = node->caps & V4L2_CAP_READWRITE; + int fd_flags = fcntl(node->fd, F_GETFL); char buf = 0; int ret; + fcntl(node->fd, F_SETFL, fd_flags | O_NONBLOCK); if (node->can_capture) ret = read(node->fd, &buf, 1); else @@ -154,20 +156,22 @@ int testReadWrite(struct node *node) // Note: RDS can only return multiples of 3, so we accept // both 0 and 1 as return code. if (can_rw) - fail_on_test(ret != 0 && ret != 1); + fail_on_test((ret < 0 && errno != EAGAIN) || ret > 1); else fail_on_test(ret < 0 && errno != EINVAL); if (!can_rw) - return 0; + goto rw_exit; reopen(node); + fcntl(node->fd, F_SETFL, fd_flags | O_NONBLOCK); /* check that the close cleared the busy flag */ if (node->can_capture) ret = read(node->fd, &buf, 1); else ret = write(node->fd, &buf, 1); - fail_on_test(ret != 0 && ret != 1); + fail_on_test((ret < 0 && errno != EAGAIN) || ret > 1); +rw_exit: reopen(node); return 0; } _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
