Commit 1a84bcc5 authored by Patrick Welche's avatar Patrick Welche Committed by Andrey Kamaev

NetBSD video(4) support, patch 3 of 3

xioctl() assumes that ioctl takes int request. Cope with
  int ioctl(int d, unsigned long request, ...)
to avoid "invalid argument".
parent 681ffd9a
......@@ -85,12 +85,18 @@ if(WITH_XINE)
endif(WITH_XINE)
# --- V4L ---
ocv_clear_vars(HAVE_LIBV4L HAVE_CAMV4L HAVE_CAMV4L2)
ocv_clear_vars(HAVE_LIBV4L HAVE_CAMV4L HAVE_CAMV4L2 HAVE_IOCTL_ULONG)
if(WITH_V4L)
CHECK_MODULE(libv4l1 HAVE_LIBV4L)
CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)
CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
CHECK_INCLUDE_FILE(sys/videoio.h HAVE_VIDEOIO)
INCLUDE(CheckPrototypeDefinition)
CHECK_PROTOTYPE_DEFINITION(ioctl
"int ioctl(int d, unsigned long request, ...)"
"-1"
"sys/ioctl.h"
HAVE_IOCTL_ULONG)
endif(WITH_V4L)
# --- OpenNI ---
......
......@@ -25,6 +25,9 @@
/* V4L/V4L2 capturing support via libv4l */
#cmakedefine HAVE_LIBV4L
/* ioctl takes unsigned long request rather than int */
#cmakedefine HAVE_IOCTL_ULONG
/* Carbon windowing environment */
#cmakedefine HAVE_CARBON
......
......@@ -346,7 +346,11 @@ static int numCameras = 0;
static int indexList = 0;
// IOCTL handling for V4L2
#ifdef HAVE_IOCTL_ULONG
static int xioctl( int fd, unsigned long request, void *arg)
#else
static int xioctl( int fd, int request, void *arg)
#endif
{
int r;
......
......@@ -354,17 +354,18 @@ static int icvSetVideoSize( CvCaptureCAM_V4L* capture, int w, int h);
static int numCameras = 0;
static int indexList = 0;
#ifdef HAVE_IOCTL_ULONG
static int xioctl( int fd, unsigned long request, void *arg)
#else
static int xioctl( int fd, int request, void *arg)
#endif
{
int r;
do r = ioctl (fd, request, arg);
while (-1 == r && EINTR == errno);
return r;
}
/* Simple test program: Find number of Video Sources available.
......
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