From: jinhyung.jo Date: Wed, 13 Feb 2013 07:03:16 +0000 (+0900) Subject: maru_camera : fixed a bug that occurs a lock-up when capture. X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1078 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82b0a36a31688f21a5012038f95e99af43866e8d;p=sdk%2Femulator%2Fqemu.git maru_camera : fixed a bug that occurs a lock-up when capture. The cause of this issue is that continuous timeout is occurred on select(). (The webcam on host PC does not work properly for some reason.) Fixed as follows: If the timeout occurs for 5 seconds continually, raises a error and notifies to upper layer. Signed-off-by: Jinhyung Jo --- diff --git a/tizen/src/hw/maru_camera_linux_pci.c b/tizen/src/hw/maru_camera_linux_pci.c index 66ab2aa796..a6682f63cc 100644 --- a/tizen/src/hw/maru_camera_linux_pci.c +++ b/tizen/src/hw/maru_camera_linux_pci.c @@ -464,6 +464,7 @@ static int __v4l2_streaming(MaruCamState *state) fd_set fds; struct timeval tv; int ret; + static uint32_t timeout_n; FD_ZERO(&fds); FD_SET(v4l2_fd, &fds); @@ -481,7 +482,12 @@ static int __v4l2_streaming(MaruCamState *state) __raise_err_intr(state); return -1; } else if (!ret) { - ERR("Select timed out\n"); + timeout_n++; + ERR("Select timed out: count(%u)\n", timeout_n); + if (timeout_n >= 5) { + __raise_err_intr(state); + return -1; + } return 0; } @@ -497,6 +503,12 @@ static int __v4l2_streaming(MaruCamState *state) __raise_err_intr(state); return -1; } + + /* clear the skip count for select time-out */ + if (timeout_n > 0) { + timeout_n = 0; + } + return 0; }