--- configure.ac 2011-04-29 20:04:41.000000000 +0200 +++ configure.ac 2011-05-06 01:23:59.000000000 +0200 @@ -655,6 +655,15 @@ #include #endif]) +AC_CHECK_HEADERS([linux/videodev2.h],,, +[#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#ifdef HAVE_ASM_TYPES_H +#include +#endif]) + dnl Check for broken kernel header that doesn't define __user AC_CHECK_HEADERS([linux/capi.h],,,[#define __user]) --- dlls/avicap32/avicap32_main.c 2011-04-29 20:04:41.000000000 +0200 +++ dlls/avicap32/avicap32_main.c 2011-05-06 01:37:46.000000000 +0200 @@ -41,6 +41,9 @@ #ifdef HAVE_LINUX_VIDEODEV_H # include #endif +#ifdef HAVE_LINUX_VIDEODEV2_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif @@ -91,7 +94,7 @@ return retW; } -#ifdef HAVE_LINUX_VIDEODEV_H +#if defined(HAVE_LINUX_VIDEODEV_H) || defined (HAVE_LINUX_VIDEODEV2_H) static int xioctl(int fd, int request, void * arg) { @@ -108,8 +111,10 @@ int fd; char device[16]; struct stat st; +#ifdef HAVE_LINUX_VIDEODEV_H struct video_capability capa; -#ifdef HAVE_V4L2 +#endif +#ifdef HAVE_LINUX_VIDEODEV2_H struct v4l2_capability caps; #endif @@ -132,7 +137,7 @@ return FALSE; } -#ifdef HAVE_V4L2 +#ifdef HAVE_LINUX_VIDEODEV2_H memset(&caps, 0, sizeof(caps)); if (xioctl(fd, VIDIOC_QUERYCAP, &caps) != -1) { lstrcpynA(name, (char *)caps.card, namesize); @@ -143,24 +148,33 @@ } if (errno != EINVAL && errno != 515) +#ifndef HAVE_LINUX_VIDEODEV_H + ERR("%s: Querying failed: %s\n", device, strerror(errno)); + else ERR("%s: Querying failed: Not a V4L compatible device\n", device); + close(fd); + return FALSE; +#else WARN("%s: ioctl failed: %s -- Falling back to V4L\n", device, strerror(errno)); else WARN("%s: Not a V4L2 compatible device, trying V4l 1\n", device); -#endif /* HAVE_V4L2 */ +#endif /* ! HAVE_LINUX_VIDEODEV_H */ +#endif /* HAVE_LINUX_VIDEODEV2_H */ +#ifdef HAVE_LINUX_VIDEODEV_H memset(&capa, 0, sizeof(capa)); - if (xioctl(fd, VIDIOCGCAP, &capa) == -1) { + if (xioctl(fd, VIDIOCGCAP, &capa) != -1) { + lstrcpynA(name, capa.name, namesize); + lstrcpynA(version, device, versionsize); + close(fd); + return TRUE; + } + /* errno 515 is used by some webcam drivers for unknown IOICTL command */ if (errno != EINVAL && errno != 515) ERR("%s: Querying failed: %s\n", device, strerror(errno)); else ERR("%s: Querying failed: Not a V4L compatible device\n", device); close(fd); return FALSE; - } - - lstrcpynA(name, capa.name, namesize); - lstrcpynA(version, device, versionsize); - close(fd); - return TRUE; +#endif /* HAVE_LINUX_VIDEODEV_H */ } #else /* HAVE_LINUX_VIDEODEV_H */