2009-01-08 02:08:37 +01:00
|
|
|
$NetBSD: patch-ah,v 1.2 2009/01/08 01:08:37 jmcneill Exp $
|
2008-09-09 13:50:18 +02:00
|
|
|
|
|
|
|
|
2009-01-08 02:08:37 +01:00
|
|
|
--- cpi/v4l2cpi/v4l2.c.orig 2008-10-03 12:20:06.000000000 -0400
|
|
|
|
+++ cpi/v4l2cpi/v4l2.c
|
2008-09-09 13:50:18 +02:00
|
|
|
@@ -43,8 +43,12 @@
|
|
|
|
#include <errno.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
+#ifdef __linux__
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/videodev2.h>
|
|
|
|
+#elif defined(__NetBSD__)
|
|
|
|
+#include <sys/videoio.h>
|
|
|
|
+#endif
|
|
|
|
#include "v4l2.h"
|
|
|
|
|
|
|
|
#include "tisuvccam.h"
|
2009-01-08 02:08:37 +01:00
|
|
|
@@ -2396,11 +2400,15 @@ static void v4l2_capture_thread( v4l2_ha
|
2008-09-09 13:50:18 +02:00
|
|
|
|
|
|
|
old_index = handle->dqindex;
|
|
|
|
|
|
|
|
+#ifdef __NetBSD__
|
|
|
|
+ sem_wait( &handle->sema );
|
|
|
|
+#else
|
|
|
|
if( sem_timedwait( &handle->sema, &abs_timeout ) )
|
|
|
|
{
|
|
|
|
TRACE( "SEM_WAIT FAILED\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if( ( ( handle->dqindex + 1 ) % handle->buffer_count ) == handle->qindex )
|
|
|
|
{
|
2009-01-08 02:08:37 +01:00
|
|
|
@@ -2503,7 +2511,11 @@ static void v4l2_capture_thread( v4l2_ha
|
2008-09-09 13:50:18 +02:00
|
|
|
|
|
|
|
if( handle->io_method == CPI_V4L2_IO_METHOD_MMAP )
|
|
|
|
{
|
|
|
|
+#ifdef __NetBSD__
|
|
|
|
+ while( sem_wait( &handle->sema ) )
|
|
|
|
+#else
|
|
|
|
while( sem_timedwait( &handle->sema, &abs_timeout ) )
|
|
|
|
+#endif
|
|
|
|
{
|
|
|
|
TRACE( "SEM_WAIT FAILED!\n" );
|
|
|
|
gettimeofday( &ctime, NULL );
|