$NetBSD: patch-ah,v 1.2 2009/01/08 01:08:37 jmcneill Exp $


--- cpi/v4l2cpi/v4l2.c.orig	2008-10-03 12:20:06.000000000 -0400
+++ cpi/v4l2cpi/v4l2.c
@@ -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"
@@ -2396,11 +2400,15 @@ static void v4l2_capture_thread( v4l2_ha
 
       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 )
       {
@@ -2503,7 +2511,11 @@ static void v4l2_capture_thread( v4l2_ha
 	 
 	 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 );
