Re: 046d:08d9 - works with gspca-modules but not 2.6.27-rc3

Hans de Goede <[email protected]> Mon, 01 Sep 2008 09:21:29 +0200
Newsgroups gmane.linux.drivers.spca50x.devel
Message-ID <[email protected]>
Arthur Marsh wrote:
> Jean-Francois Moine wrote, on 30/08/08 15:42:
> 
>> You have cloned my mercurial tree in '/usr/src/gspca'. Do:
>>
>>     cd /usr/src/gspca
>>     cp /usr/src/linux-2.6.27-rc4/.config v4l/
>>     make menuconfig
>>         (or 'make gconfig'...)
>>
>> In menuconfig, add the GSPCA driver if it is not set.
>> Then do:
>>
>>     make
>>     sudo make install
>>
>> This last command will overwrite all the V4L modules
>> of /lib/modules/`uname -r`/kernel/drivers/media/).
>> This is normal.
>>
>> If your webcam was connected, unplug it and, as root, do:
>>
>>     rmmod gspca_zc3xx
>>     rmmod gspca_main
>>
>> Then plug the webcam. There should be no error looking at:
>>
>>     dmesg | tail
>>
>> Best regards.
>>
> 
> Although the attached log file looks successful, I still get a green 
> screen when using the web-cam via vlc.
> 
> Any further suggestions?
> 

Don't use vlc to access webcams, vlc's webcam support is from the stoneage.

If you do want to use vlc, compile it with the attached patch (requires libv4l 
to be installed) to make it somewhat less stoneage-ish.

Regards,

Hans

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Spca50x-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spca50x-devs
vlc-0.8.6-libv4l1.patch (text/plain, 13.4 KB)
diff -up vlc-0.8.6f/modules/access/v4l/Makefile.am~ vlc-0.8.6f/modules/access/v4l/Makefile.am
--- vlc-0.8.6f/modules/access/v4l/Makefile.am~	2008-06-29 17:14:11.000000000 +0200
+++ vlc-0.8.6f/modules/access/v4l/Makefile.am	2008-06-29 17:16:39.000000000 +0200
@@ -100,7 +100,7 @@ libv4l_plugin_la_CXXFLAGS = `$(VLC_CONFI
 libv4l_plugin_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags plugin v4l`
 libv4l_plugin_la_LDFLAGS = `$(VLC_CONFIG) --libs plugin v4l` \
 	-rpath '$(libvlcdir)' -avoid-version -module -shrext $(LIBEXT)
-libv4l_plugin_la_LIBADD = $(LTLIBVLC)
+libv4l_plugin_la_LIBADD = $(LTLIBVLC) -lv4l1
 
 libv4l_a_SOURCES = $(SOURCES_v4l)
 libv4l_builtin_la_SOURCES = $(SOURCES_v4l)
diff -up vlc-0.8.6f/modules/access/v4l/Makefile.in~ vlc-0.8.6f/modules/access/v4l/Makefile.in
--- vlc-0.8.6f/modules/access/v4l/Makefile.in~	2008-06-29 17:16:22.000000000 +0200
+++ vlc-0.8.6f/modules/access/v4l/Makefile.in	2008-06-29 17:16:42.000000000 +0200
@@ -390,7 +390,7 @@ libv4l_plugin_la_OBJCFLAGS = `$(VLC_CONF
 libv4l_plugin_la_LDFLAGS = `$(VLC_CONFIG) --libs plugin v4l` \
 	-rpath '$(libvlcdir)' -avoid-version -module -shrext $(LIBEXT)
 
-libv4l_plugin_la_LIBADD = $(LTLIBVLC)
+libv4l_plugin_la_LIBADD = $(LTLIBVLC) -lv4l1
 libv4l_a_SOURCES = $(SOURCES_v4l)
 libv4l_builtin_la_SOURCES = $(SOURCES_v4l)
 libv4l_a_CFLAGS = `$(VLC_CONFIG) --cflags builtin pic v4l`
diff -up vlc-0.8.6f/modules/access/v4l/v4l.c~ vlc-0.8.6f/modules/access/v4l/v4l.c
--- vlc-0.8.6f/modules/access/v4l/v4l.c~	2008-06-29 17:13:30.000000000 +0200
+++ vlc-0.8.6f/modules/access/v4l/v4l.c	2008-06-29 17:13:30.000000000 +0200
@@ -64,6 +64,9 @@
 
 #include <sys/soundcard.h>
 
+#include <libv4l1.h>
+
+
 /*****************************************************************************
  * Module descriptior
  *****************************************************************************/
@@ -546,23 +549,23 @@ static void Close( vlc_object_t *p_this 
     if( p_sys->psz_device ) free( p_sys->psz_device );
     if( p_sys->psz_vdev )   free( p_sys->psz_vdev );
     if( p_sys->psz_adev )   free( p_sys->psz_adev );
-    if( p_sys->fd_video >= 0 ) close( p_sys->fd_video );
+    if( p_sys->fd_video >= 0 ) v4l1_close( p_sys->fd_video );
     if( p_sys->fd_audio >= 0 ) close( p_sys->fd_audio );
     if( p_sys->p_block_audio ) block_Release( p_sys->p_block_audio );
 
     if( p_sys->b_mjpeg )
     {
         int i_noframe = -1;
-        ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT, &i_noframe );
+        v4l1_ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT, &i_noframe );
     }
 
     if( p_sys->p_video_mmap && p_sys->p_video_mmap != MAP_FAILED )
     {
         if( p_sys->b_mjpeg )
-            munmap( p_sys->p_video_mmap, p_sys->mjpeg_buffers.size *
+            v4l1_munmap( p_sys->p_video_mmap, p_sys->mjpeg_buffers.size *
                     p_sys->mjpeg_buffers.count );
         else
-            munmap( p_sys->p_video_mmap, p_sys->vid_mbuf.size );
+            v4l1_munmap( p_sys->p_video_mmap, p_sys->vid_mbuf.size );
     }
 
     free( p_sys );
@@ -875,13 +878,13 @@ static int OpenVideoDev( demux_t *p_demu
     struct mjpeg_params mjpeg;
     int i;
 
-    if( ( i_fd = open( psz_device, O_RDWR ) ) < 0 )
+    if( ( i_fd = v4l1_open( psz_device, O_RDWR ) ) < 0 )
     {
         msg_Err( p_demux, "cannot open device (%s)", strerror( errno ) );
         goto vdev_failed;
     }
 
-    if( ioctl( i_fd, VIDIOCGCAP, &p_sys->vid_cap ) < 0 )
+    if( v4l1_ioctl( i_fd, VIDIOCGCAP, &p_sys->vid_cap ) < 0 )
     {
         msg_Err( p_demux, "cannot get capabilities (%s)", strerror( errno ) );
         goto vdev_failed;
@@ -926,7 +929,7 @@ static int OpenVideoDev( demux_t *p_demu
     }
 
     vid_channel.channel = p_sys->i_channel;
-    if( ioctl( i_fd, VIDIOCGCHAN, &vid_channel ) < 0 )
+    if( v4l1_ioctl( i_fd, VIDIOCGCHAN, &vid_channel ) < 0 )
     {
         msg_Err( p_demux, "cannot get channel infos (%s)",
                           strerror( errno ) );
@@ -944,7 +947,7 @@ static int OpenVideoDev( demux_t *p_demu
     }
 
     vid_channel.norm = p_sys->i_norm;
-    if( ioctl( i_fd, VIDIOCSCHAN, &vid_channel ) < 0 )
+    if( v4l1_ioctl( i_fd, VIDIOCSCHAN, &vid_channel ) < 0 )
     {
         msg_Err( p_demux, "cannot set channel (%s)", strerror( errno ) );
         goto vdev_failed;
@@ -959,7 +962,7 @@ static int OpenVideoDev( demux_t *p_demu
         if( p_sys->i_tuner >= 0 )
         {
             vid_tuner.tuner = p_sys->i_tuner;
-            if( ioctl( i_fd, VIDIOCGTUNER, &vid_tuner ) < 0 )
+            if( v4l1_ioctl( i_fd, VIDIOCGTUNER, &vid_tuner ) < 0 )
             {
                 msg_Err( p_demux, "cannot get tuner (%s)", strerror( errno ) );
                 goto vdev_failed;
@@ -974,7 +977,7 @@ static int OpenVideoDev( demux_t *p_demu
 
             /* FIXME FIXME to be checked FIXME FIXME */
             //vid_tuner.mode = p_sys->i_norm;
-            if( ioctl( i_fd, VIDIOCSTUNER, &vid_tuner ) < 0 )
+            if( v4l1_ioctl( i_fd, VIDIOCSTUNER, &vid_tuner ) < 0 )
             {
                 msg_Err( p_demux, "cannot set tuner (%s)", strerror( errno ) );
                 goto vdev_failed;
@@ -990,7 +993,7 @@ static int OpenVideoDev( demux_t *p_demu
         if( p_sys->i_frequency >= 0 )
         {
             int driver_frequency = p_sys->i_frequency * 16 /1000;
-            if( ioctl( i_fd, VIDIOCSFREQ, &driver_frequency ) < 0 )
+            if( v4l1_ioctl( i_fd, VIDIOCSFREQ, &driver_frequency ) < 0 )
             {
                 msg_Err( p_demux, "cannot set frequency (%s)",
                                   strerror( errno ) );
@@ -1010,7 +1013,7 @@ static int OpenVideoDev( demux_t *p_demu
         if( p_sys->i_audio >= 0 )
         {
             vid_audio.audio = p_sys->i_audio;
-            if( ioctl( i_fd, VIDIOCGAUDIO, &vid_audio ) < 0 )
+            if( v4l1_ioctl( i_fd, VIDIOCGAUDIO, &vid_audio ) < 0 )
             {
                 msg_Err( p_demux, "cannot get audio (%s)", strerror( errno ) );
                 goto vdev_failed;
@@ -1019,7 +1022,7 @@ static int OpenVideoDev( demux_t *p_demu
             /* unmute audio */
             vid_audio.flags &= ~VIDEO_AUDIO_MUTE;
 
-            if( ioctl( i_fd, VIDIOCSAUDIO, &vid_audio ) < 0 )
+            if( v4l1_ioctl( i_fd, VIDIOCSAUDIO, &vid_audio ) < 0 )
             {
                 msg_Err( p_demux, "cannot set audio (%s)", strerror( errno ) );
                 goto vdev_failed;
@@ -1035,7 +1038,7 @@ static int OpenVideoDev( demux_t *p_demu
         struct quicktime_mjpeg_app1 *p_app1;
         int32_t i_offset;
 
-        if( ioctl( i_fd, MJPIOC_G_PARAMS, &mjpeg ) < 0 )
+        if( v4l1_ioctl( i_fd, MJPIOC_G_PARAMS, &mjpeg ) < 0 )
         {
             msg_Err( p_demux, "cannot get mjpeg params (%s)",
                               strerror( errno ) );
@@ -1086,7 +1089,7 @@ static int OpenVideoDev( demux_t *p_demu
          * optional.  They will be present in the output. */
         mjpeg.jpeg_markers = JPEG_MARKER_DHT | JPEG_MARKER_DQT;
 
-        if( ioctl( i_fd, MJPIOC_S_PARAMS, &mjpeg ) < 0 )
+        if( v4l1_ioctl( i_fd, MJPIOC_S_PARAMS, &mjpeg ) < 0 )
         {
             msg_Err( p_demux, "cannot set mjpeg params (%s)",
                               strerror( errno ) );
@@ -1103,7 +1106,7 @@ static int OpenVideoDev( demux_t *p_demu
     {
         struct video_window vid_win;
 
-        if( ioctl( i_fd, VIDIOCGWIN, &vid_win ) < 0 )
+        if( v4l1_ioctl( i_fd, VIDIOCGWIN, &vid_win ) < 0 )
         {
             msg_Err( p_demux, "cannot get win (%s)", strerror( errno ) );
             goto vdev_failed;
@@ -1130,7 +1133,7 @@ static int OpenVideoDev( demux_t *p_demu
     if( !p_sys->b_mjpeg )
     {
         /* set hue/color/.. */
-        if( ioctl( i_fd, VIDIOCGPICT, &p_sys->vid_picture ) == 0 )
+        if( v4l1_ioctl( i_fd, VIDIOCGPICT, &p_sys->vid_picture ) == 0 )
         {
             struct video_picture vid_picture = p_sys->vid_picture;
 
@@ -1150,7 +1153,7 @@ static int OpenVideoDev( demux_t *p_demu
             {
                 vid_picture.contrast = p_sys->i_contrast;
             }
-            if( ioctl( i_fd, VIDIOCSPICT, &vid_picture ) == 0 )
+            if( v4l1_ioctl( i_fd, VIDIOCSPICT, &vid_picture ) == 0 )
             {
                 msg_Dbg( p_demux, "v4l device uses brightness: %d",
                          vid_picture.brightness );
@@ -1164,7 +1167,7 @@ static int OpenVideoDev( demux_t *p_demu
         }
 
         /* Find out video format used by device */
-        if( ioctl( i_fd, VIDIOCGPICT, &p_sys->vid_picture ) == 0 )
+        if( v4l1_ioctl( i_fd, VIDIOCGPICT, &p_sys->vid_picture ) == 0 )
         {
             struct video_picture vid_picture = p_sys->vid_picture;
             char *psz;
@@ -1191,7 +1194,7 @@ static int OpenVideoDev( demux_t *p_demu
             free( psz );
 
             if( vid_picture.palette &&
-                !ioctl( i_fd, VIDIOCSPICT, &vid_picture ) )
+                !v4l1_ioctl( i_fd, VIDIOCSPICT, &vid_picture ) )
             {
                 p_sys->vid_picture = vid_picture;
             }
@@ -1199,14 +1202,14 @@ static int OpenVideoDev( demux_t *p_demu
             {
                 /* Try to set the format to something easy to encode */
                 vid_picture.palette = VIDEO_PALETTE_YUV420P;
-                if( ioctl( i_fd, VIDIOCSPICT, &vid_picture ) == 0 )
+                if( v4l1_ioctl( i_fd, VIDIOCSPICT, &vid_picture ) == 0 )
                 {
                     p_sys->vid_picture = vid_picture;
                 }
                 else
                 {
                     vid_picture.palette = VIDEO_PALETTE_YUV422P;
-                    if( ioctl( i_fd, VIDIOCSPICT, &vid_picture ) == 0 )
+                    if( v4l1_ioctl( i_fd, VIDIOCSPICT, &vid_picture ) == 0 )
                     {
                         p_sys->vid_picture = vid_picture;
                     }
@@ -1237,13 +1240,13 @@ static int OpenVideoDev( demux_t *p_demu
         p_sys->mjpeg_buffers.count = 8;
         p_sys->mjpeg_buffers.size = MJPEG_BUFFER_SIZE;
 
-        if( ioctl( i_fd, MJPIOC_REQBUFS, &p_sys->mjpeg_buffers ) < 0 )
+        if( v4l1_ioctl( i_fd, MJPIOC_REQBUFS, &p_sys->mjpeg_buffers ) < 0 )
         {
             msg_Err( p_demux, "mmap unsupported" );
             goto vdev_failed;
         }
 
-        p_sys->p_video_mmap = mmap( 0,
+        p_sys->p_video_mmap = v4l1_mmap( 0,
                 p_sys->mjpeg_buffers.size * p_sys->mjpeg_buffers.count,
                 PROT_READ | PROT_WRITE, MAP_SHARED, i_fd, 0 );
         if( p_sys->p_video_mmap == MAP_FAILED )
@@ -1258,7 +1261,7 @@ static int OpenVideoDev( demux_t *p_demu
         /* queue up all the frames */
         for( i = 0; i < (int)p_sys->mjpeg_buffers.count; i++ )
         {
-            if( ioctl( i_fd, MJPIOC_QBUF_CAPT, &i ) < 0 )
+            if( v4l1_ioctl( i_fd, MJPIOC_QBUF_CAPT, &i ) < 0 )
             {
                 msg_Err( p_demux, "unable to queue frame" );
                 goto vdev_failed;
@@ -1289,13 +1292,13 @@ static int OpenVideoDev( demux_t *p_demu
                 (char*)&p_sys->i_fourcc );
 
         /* Allocate mmap buffer */
-        if( ioctl( i_fd, VIDIOCGMBUF, &p_sys->vid_mbuf ) < 0 )
+        if( v4l1_ioctl( i_fd, VIDIOCGMBUF, &p_sys->vid_mbuf ) < 0 )
         {
             msg_Err( p_demux, "mmap unsupported" );
             goto vdev_failed;
         }
 
-        p_sys->p_video_mmap = mmap( 0, p_sys->vid_mbuf.size,
+        p_sys->p_video_mmap = v4l1_mmap( 0, p_sys->vid_mbuf.size,
                                     PROT_READ|PROT_WRITE, MAP_SHARED,
                                     i_fd, 0 );
         if( p_sys->p_video_mmap == MAP_FAILED )
@@ -1310,7 +1313,7 @@ static int OpenVideoDev( demux_t *p_demu
         p_sys->vid_mmap.width  = p_sys->i_width;
         p_sys->vid_mmap.height = p_sys->i_height;
         p_sys->vid_mmap.format = p_sys->vid_picture.palette;
-        if( ioctl( i_fd, VIDIOCMCAPTURE, &p_sys->vid_mmap ) < 0 )
+        if( v4l1_ioctl( i_fd, VIDIOCMCAPTURE, &p_sys->vid_mmap ) < 0 )
         {
             msg_Warn( p_demux, "%4.4s refused", (char*)&p_sys->i_fourcc );
             msg_Err( p_demux, "chroma selection failed" );
@@ -1321,7 +1324,7 @@ static int OpenVideoDev( demux_t *p_demu
 
 vdev_failed:
 
-    if( i_fd >= 0 ) close( i_fd );
+    if( i_fd >= 0 ) v4l1_close( i_fd );
     return -1;
 }
 
@@ -1431,7 +1434,7 @@ static uint8_t *GrabCapture( demux_t *p_
 
     p_sys->vid_mmap.frame = (p_sys->i_frame_pos + 1) % p_sys->vid_mbuf.frames;
 
-    while( ioctl( p_sys->fd_video, VIDIOCMCAPTURE, &p_sys->vid_mmap ) < 0 )
+    while( v4l1_ioctl( p_sys->fd_video, VIDIOCMCAPTURE, &p_sys->vid_mmap ) < 0 )
     {
         if( errno != EAGAIN )
         {
@@ -1447,7 +1450,7 @@ static uint8_t *GrabCapture( demux_t *p_
         msg_Dbg( p_demux, "grab failed, trying again" );
     }
 
-    while( ioctl(p_sys->fd_video, VIDIOCSYNC, &p_sys->i_frame_pos) < 0 )
+    while( v4l1_ioctl(p_sys->fd_video, VIDIOCSYNC, &p_sys->i_frame_pos) < 0 )
     {
         if( errno != EAGAIN && errno != EINTR )    
         {
@@ -1473,7 +1476,7 @@ static uint8_t *GrabMJPEG( demux_t *p_de
     /* re-queue the last frame we sync'd */
     if( p_sys->i_frame_pos != -1 )
     {
-        while( ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT,
+        while( v4l1_ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT,
                                        &p_sys->i_frame_pos ) < 0 )
         {
             if( errno != EAGAIN && errno != EINTR )
@@ -1485,7 +1488,7 @@ static uint8_t *GrabMJPEG( demux_t *p_de
     }
 
     /* sync on the next frame */
-    while( ioctl( p_sys->fd_video, MJPIOC_SYNC, &sync ) < 0 )
+    while( v4l1_ioctl( p_sys->fd_video, MJPIOC_SYNC, &sync ) < 0 )
     {
         if( errno != EAGAIN && errno != EINTR )    
         {