--- ../libopencv_unicap2-0.1.2-Source/opencv_unicap2.cc	2011-08-25 11:55:44.000000000 -0300
+++ opencv_unicap2.cc	2012-10-05 12:32:11.792509563 -0300
@@ -76,6 +76,7 @@
 #include <ucil.h>
 }
 #include <atomic_ops.h>
+#include <stdio.h>
 
 
 //Remove when insert into opencv
@@ -404,8 +405,19 @@
   //actualy, the fourcc settings should be swapped, but ucil only
   //has BGR3 to RGB3, so we must set on this format to get the
   //buffer in bgr order.
+  int m;
   buffer.format.fourcc = UCIL_FOURCC('R','G','B','3');
-  raw_buffer.frame.format.fourcc = UCIL_FOURCC('B','G','R','3');
+  for(m = 0; SUCCESS( unicap_enumerate_formats( handle, NULL, &format, m ) ); m++ )
+        {
+             if (format.fourcc == UCIL_FOURCC('B','G','R','3')) {
+                raw_buffer.frame.format.fourcc = UCIL_FOURCC('B','G','R','3');
+                break;
+             }
+             if (format.fourcc == UCIL_FOURCC('Y','8','0','0')) {
+                raw_buffer.frame.format.fourcc = UCIL_FOURCC('Y','8','0','0');
+                break;
+             }
+          }
 
   buffer.format.bpp = 24;
   // * todo support greyscale output
