Commit 9988e1b6 authored by Todor Tomov's avatar Todor Tomov

cap_v4l: Fix private control enumeration end condition

Currently the private control enumeration will be stopped when QUERYCTRL
returns -EINVAL only. It is possible however that other errors occur.

One particular case is when the v4l2 device doesn't support any controls
and doesn't implement the QUERYCTRL ioctl. In that case the v4l2
framework returns -ENOTTY. In that case the current control enumeration
will go in an endless loop.

To fix this change the control enumeration stop condition. If any errors
occur, end the control enumeration.
Signed-off-by: 's avatarTodor Tomov <todor.tomov@linaro.org>
parent 0f0a82b6
......@@ -512,9 +512,11 @@ static void v4l2_scan_controls(CvCaptureCAM_V4L* capture)
for (ctrl_id = V4L2_CID_PRIVATE_BASE;;ctrl_id++)
{
errno = 0;
v4l2_control_range(capture, ctrl_id);
if (errno == EINVAL)
if (errno)
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment