# gspcav1 do not compile - zen-sources

## Holysword

I have this output:

```
* Determining the location of the kernel source code

 * Found kernel source directory:

 * /usr/src/linux

 * Found sources for kernel version:

 * 2.6.27-rc7-zen3-01931-g513b057-dirty

 * Checking for suitable kernel configuration options...                  [ ok ]

>>> Unpacking source...

>>> Unpacking gspcav1-20071224.tar.gz to /var/tmp/portage/media-video/gspcav1-20071224/work

 * Converting gspcav1-20071224/Makefile to use M= instead of SUBDIRS= ..  [ ok ]

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224 ...

 * Preparing gspca module

make -C /usr/src/linux M=/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224 CC=x86_64-pc-linux-gnu-gcc modules

make[1]: Entering directory `/usr/src/zen-sources'

  CC [M]  /var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.o

  CC [M]  /var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/decoder/gspcadecoder.o

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:54:27: error: asm/semaphore.h: No such file or directory

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c: In function ‘spca5xx_ioctl’:

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2463: error: implicit declaration of function ‘video_usercopy’

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c: At top level:

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2604: error: ‘v4l_compat_ioctl32’ undeclared here (not in a function)

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2609: error: unknown field ‘owner’ specified in initializer

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2609: warning: initialization from incompatible pointer type

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2611: error: unknown field ‘type’ specified in initializer

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c: In function ‘spca50x_create_sysfs’:

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2769: error: implicit declaration of function ‘video_device_create_file’

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:2780: error: implicit declaration of function ‘video_device_remove_file’

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c: In function ‘spca5xx_probe’:

/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.c:4301: error: incompatible types in assignment

make[2]: *** [/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224/gspca_core.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [_module_/var/tmp/portage/media-video/gspcav1-20071224/work/gspcav1-20071224] Error 2

make[1]: Leaving directory `/usr/src/zen-sources'

make: *** [default] Error 2
```

I heard that there is a change in new kernels about asm/semaphore.h, but I'm not exactly sure about how to fix it... I tried to change the gspca_core.c file, and put linux/semaphore.h, but it only suppress this error, and all other erros keep on appearing, so I'm clearly missing something...

Well, appreciate any help...

----------

## Holysword

I'm trying to fix it manually, as no one gave me a better idea up to now...

2 simple alterations seems to make the things better. The first one is to change the asm/semaphore.h for linux/semaphore.h - which seems to be obvious (or dont? ><")

The other things it to add a new include: media/v4l2-ioctl.h

Now the ocmpilation give me another error

```
make -C /lib/modules/`uname -r`/build SUBDIRS=/manl/gspcav1-20071224 CC=cc modules

make[1]: Entering directory `/usr/src/zen-sources'

  CC [M]  /manl/gspcav1-20071224/gspca_core.o

/manl/gspcav1-20071224/gspca_core.c:2610: error: unknown field ‘owner’ specified in initializer

/manl/gspcav1-20071224/gspca_core.c:2610: warning: initialization from incompatible pointer type

/manl/gspcav1-20071224/gspca_core.c:2612: error: unknown field ‘type’ specified in initializer

/manl/gspcav1-20071224/gspca_core.c: In function ‘spca50x_create_sysfs’:

/manl/gspcav1-20071224/gspca_core.c:2770: error: implicit declaration of function ‘video_device_create_file’

/manl/gspcav1-20071224/gspca_core.c:2781: error: implicit declaration of function ‘video_device_remove_file’

/manl/gspcav1-20071224/gspca_core.c: In function ‘spca5xx_probe’:

/manl/gspcav1-20071224/gspca_core.c:4302: error: incompatible types in assignment

make[2]: *** [/manl/gspcav1-20071224/gspca_core.o] Error 1

make[1]: *** [_module_/manl/gspcav1-20071224] Error 2

make[1]: Leaving directory `/usr/src/zen-sources'

make: *** [default] Error 2

[5]-  Done                    kwrite ./gspca_core.c
```

that occurs into these lines of gspca_core.c:

```
static struct video_device spca50x_template = {

   .owner = THIS_MODULE,

   .name = "GSPCA USB Camera",

   .type = VID_TYPE_CAPTURE,

#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)   

   .hardware = VID_HARDWARE_GSPCA,

#endif

   .fops = &spca5xx_fops,

   .release = video_device_release,

   .minor = -1,

};
```

The definition of video_device can be found at /usr/src/linux/include/media/v4l2-dev.h, but I cannot see the field "owner" in it =S

----------

## Etal

Guess what? The GSPCA drivers are now in the kernel!  :Razz: 

----------

## Holysword

Yes, I saw that, but they do not work. I'll post here the error that appear, wait a second.

EDIT#1:

```
holysword@kuroiryu ~ $ spcaview

 Spcaview version: 1.1.7 date: 06:11:2006 (C) mxhaard@magic.fr

Initializing SDL.

SDL initialized.

bpp 3 format 15

Using video device /dev/video0.

Initializing v4l.

**************** PROBING CAMERA *********************

Camera found: PC Camera

Hmm did not support Video_channel

*****************************************************

 grabbing method default MMAP asked

VIDIOCGMBUF size 475136  frames 4  offets[0]=0 offsets[1]=118784

VIDIOCGPICT

brightnes=32896 hue=0 color=0 contrast=32768 whiteness=26214

depth=8 palette=0

VIDIOCSPICT

brightness=32896 hue=0 color=0 contrast=32768 whiteness=26214

depth=24 palette=15
```

The spcaview crashes and do not close anymore (only a "speciall kill" can close it XD).

The same webcam used to work with zen-sources few time ago (of course, an older version of zen-sourcers) with portage driver... that's why I'm trying to make it work with the outer driver =S

Should I do something different?

----------

## ferrarif5

Hi,

I've got the same problem, camera worked fine in .26, I've got a logitech Quickcam II, when I run spcaview I get the same error then segfault. Anyone got any ideas?

Update:

Just tried modularising the driver to load the specific module for my cam:

```

#lsusb

Bus 002 Device 002: ID 046d:0928 Logitech, Inc. Quickcam Express

```

According to Documentation/video4linux/gspca.txt the device id uses the spca561

<sourced from kernel doc>

spca561         046d:0928       Logitech QC Express Etch2

So I tried modprobing spca561 module to which I get the following:

```

# modprobe gspca_spca561

WARNING: Error inserting gspca_main (/lib/modules/2.6.27-gentoo/kernel/drivers/media/video/gspca/gspca_main.ko): Invalid argument

FATAL: Error inserting gspca_spca561 (/lib/modules/2.6.27-gentoo/kernel/drivers/media/video/gspca/gspca_spca561.ko): Operation not permitted

```

----------

## Holysword

I tried both in module and in kernel, and none worked too.

Here the module loads fine, but I got the same problem with spcaview

----------

## Vardigon

```
lue@trinite-2 ~ $ spcaview

 Spcaview version: 1.1.7 date: 06:11:2006 (C) mxhaard@magic.fr 

Initializing SDL.

SDL initialized.

bpp 3 format 15

Using video device /dev/video0.

Initializing v4l.

**************** PROBING CAMERA *********************

Camera found: Logitech QuickCam IM/Connect  

Bridge found: ZC301-2 

Bridge find ZC301-2 number 13

StreamId: JPEG Camera

quality 1 autoexpo 1 Timeframe 0 lightfreq 50

Bridge find ZC301-2 number 13

Available Resolutions width 640  heigth 480 native  

Available Resolutions width 352  heigth 288 decoded  

Available Resolutions width 320  heigth 240 native *

Available Resolutions width 176  heigth 144 decoded  

unable to probe size !!

*****************************************************

 grabbing method default MMAP asked 

VIDIOCGMBUF size 2457616  frames 2  offets[0]=0 offsets[1]=1228808

VIDIOCGPICT

brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0 

depth=12 palette=4

VIDIOCSPICT

brightness=32768 hue=0 color=0 contrast=32768 whiteness=0 

depth=24 palette=15 

Used 33690ms for 387 images => 87ms/image 11fps.

Quiting SDL.

Decoded frames:387 Average decode time: 1.000000

unmapping

closing

closed

Destroy Picture thread ...

Quiting....

lue@trinite-2 ~ $ 

```

----------

## Holysword

 *Vardigon wrote:*   

> 
> 
> ```
> lue@trinite-2 ~ $ spcaview
> 
> ...

 

What that was supposed to mean? ><"

----------

## rapsure

The new driver works, but you need to use libv4l because the pixel formats aren't supported by most programs. This is for the new driver in the 2.6.27 kernel.

----------

## Holysword

 *rapsure wrote:*   

> The new driver works, but you need to use libv4l because the pixel formats aren't supported by most programs. This is for the new driver in the 2.6.27 kernel.

 

media-libs/libv4l you meant? It does not work, actually it changes nothing here... the same error. I did the LD_PRELOAD thing too, and no change.

I heard that there's something to do the 32/64 bits, but I honestly don't have idea of what to do... should I compile as 32bits? How can I do it? =S

EDIT#1:

Skype runs normally with preload, but says "LD_PRELOAD could not be preloaded". When I try to test my webcam I got only a black screen

xawtv got me the following output: 

```
kuroiryu manl # LD_PRELOAD=/usr/lib64/libv4l/v4l2convert.so xawtv

This is xawtv-3.95, running on Linux/x86_64 (2.6.28-rc1-zen1-06007-g5b1517e)

WARNING: v4l-conf is compiled without DGA support.

/dev/video0 [v4l2]: no overlay support

v4l-conf had some trouble, trying to continue anyway

Warning: Missing charsets in String to FontSet conversion

Warning: Cannot convert string "-*-ledfixed-medium-r-*--39-*-*-*-c-*-*-*" to type FontStruct

Warning: Missing charsets in String to FontSet conversion

Warning: Missing charsets in String to FontSet conversion

libv4l2: error dequeuing buf: Input/output error

v4l2: read: Input/output error

v4l2: oops: select timeout

libv4l2: error requesting 2 buffers: Device or resource busy

v4l2: read: Device or resource busy

libv4l2: warning v4l2 mmap buffers still mapped on close()

kuroiryu manl #
```

----------

## rapsure

I haven't gotten xawtv to work either. To use with skype you'll need a 32-bit version of media-lib/libv4l and then skype will give you video. I'd use cheese to test the video, or camorama. Both camorama and cheese have worked with libv4l. Ekiga also works with libv4l, as well as spcaview.

----------

## keet

I have a similar problem on my AMD64 system with my Logitech webcam.  I used to use the gspcav1 module, but with kernel 2.6.27-r2, it won't compile (which probably doesn't matter since the driver is in the kernel).  After emerging libv4l, I tried:

 LD_PRELOAD=/usr/lib64/libv4l/v4l1compat.so myapp, but it just says:

ERROR: ld.so: object '/usr/lib64/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.

Skype runs, but it just shows black and green lines when I try to test my webcam.

----------

## Holysword

 *rapsure wrote:*   

> I haven't gotten xawtv to work either. To use with skype you'll need a 32-bit version of media-lib/libv4l and then skype will give you video. I'd use cheese to test the video, or camorama. Both camorama and cheese have worked with libv4l. Ekiga also works with libv4l, as well as spcaview.

 

Camorama does not work...

How do I get a 32-bit version of libv4l?? I have only the portage version, that one does not fit?

----------

## rapsure

LD_PRELOAD="/usr/lib/libv4l/v4l1compat.so" camorama -d /dev/video1 is the command I used and camorama worked for me.

----------

## Holysword

 *rapsure wrote:*   

> LD_PRELOAD="/usr/lib/libv4l/v4l1compat.so" camorama -d /dev/video1 is the command I used and camorama worked for me.

 

No clue for me.

----------

