PDA

Bekijk de volledige versie : Problem with webcam+spca5xx+palantir



gonzales01
23-03-2009, 10:26
Hi all,
I have Asus WL-500gP with dd-wrt 2.4 (2.4.35/dd-wrt.v24_mega_generic.bin) and I am trying to get my Labtec WebCam Pro working with the router but I encountered a problem with spca5xx driver and the palantir server (v2.6-1) through I wanted to share the webcam video stream.

I obtained all the USB Webcam Kernel Modules from the
20080605-usb-webcam-modules-linux-2.4.35-mips.tar.gz package (from http://dg.cascade.dyndns.org/usb-webcam-kernel-modules.html) and loaded them into kernel:

# insmod spca5xx.o
# insmod vidodev.o

dmesg reports (truncated):
usb.c: deregistering driver spca5xx
spca_core.c: driver spca5xx deregistered
usb.c: USB disconnect on device 01:03.0-2 address 2
hub.c: new USB device 01:03.0-2, assigned address 3
usb.c: USB device 3 (vend/prod 0x46d/0x8a2) is not claimed by any active driver.
Linux video capture interface: v1.00
usb.c: registered new driver spca5xx
spca_core.c: USB SPCA5XX camera found. Type Labtec Webcam Pro Zc0302 + Hdcs2020
spca_core.c: spca5xx driver 00.57.06LE registered
usb.c: USB disconnect on device 01:03.0-2 address 3
hub.c: new USB device 01:03.0-2, assigned address 4
spca_core.c: USB SPCA5XX camera found. Type Labtec Webcam Pro Zc0302 + Hdcs2020

It seems that the webcam was detected properly and also the /dev/v4l/video0 device was created.
Problem happened when I started the palantir server on the webcam device which reported following:

# palantir -C /opt/etc/palantir.conf

Mar 23 09:16:44 [main] -- palantir 2.6 starting --
Mar 23 09:16:44 [main] Definitions for 1 devices found
Mar 23 09:16:44 [main] No serial port specified
Mar 23 09:16:44 [main] No named pipe specified
Mar 23 09:16:45 [video] Card: Labtec Webcam Pro (/dev/v4l/video0)
Mar 23 09:16:45 [video] Capabilities: 1 (capture )
Mar 23 09:16:45 [video] Size: (176x144)-(640x480)
Mar 23 09:16:45 [video] Channel no. 0 ('ZC301-2') tuners: 0, flags: 0, type: 2, norm: 10929
Mar 23 09:16:45 [video] RGB palette unavailable.
Mar 23 09:16:45 [video] trying YUV420P...
Mar 23 09:16:45 [video] trying YUV422...
Mar 23 09:16:45 [video] ** Fatal error: SPICT: No such file or directory

The palantir config file (palantir.conf) contains:
VideoDevice /dev/v4l/video0
#FrameSize 320x240
FrameSize 640x480
JpegQuality 70
Audio Off
TCPPort 8000
ControlTimeOut 30
ClientTimeOut 300
MaxStreamingClients 3
VideoNorm PAL
#Palette Color
Device {
Carrier internal 0
Direction readwrite
Name "Brightness"
Hint "Video capture brightness"
Visual slider
Remap -32768 32767
Notifier Client
}

I tried to strace palantir and to have a look at the palantir and spca5xx driver sources
and it happens when the palantir calls ioctls here:

........
if(ioctl(cparms.fd,VIDIOCSPICT,&v_pic)) {
if(!mono) {
palette_yuv=1;
diag(SS_VIDEO|DEBUG,"RGB palette unavailable.\n");

diag(SS_VIDEO|DEBUG,"trying YUV420P...\n");
v_pic.palette=VIDEO_PALETTE_YUV420P;
v_pic.depth=cparms.depth=12;
if(ioctl(cparms.fd,VIDIOCSPICT,&v_pic)==0) goto pal_out;

diag(SS_VIDEO|DEBUG,"trying YUV422...\n");
v_pic.palette=VIDEO_PALETTE_YUV422;
v_pic.depth=cparms.depth=16;
if(ioctl(cparms.fd,VIDIOCSPICT,&v_pic))
diag(SS_VIDEO|DIERR,"SPICT");

pal_out: ;
}
else diag(SS_VIDEO|DIERR,"SPICT (mono palette might be unavailable)");
}
........

and the ioctl call the spca5xx driver covers around here:

...
case VIDIOCSPICT:
{
int i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)
struct video_picture *p = arg;
#else
struct video_picture p1;
struct video_picture *p = &p1;
if (copy_from_user(p, arg, sizeof(struct video_picture)))
return -EFAULT;
#endif


PDEBUG(4, "VIDIOCSPICT");
if(spca5xx_testPalSize(spca50x,p->palette,spca50x->width,spca50x->height) < 0)
return -EINVAL;

if (spca50x->format != p->palette) {
PDEBUG(4, "Setting depth=%d, palette=%d", p->depth,
p->palette);
/* change the output palette the input stream is the same */
/* no need to stop the camera streaming and restart */
for (i = 0; i < SPCA50X_NUMFRAMES; i++) {
spca50x->frame[i].depth = p->depth;
spca50x->frame[i].format = p->palette;
}
spca50x->format = p->palette;
}
spca50x->contrast = p->contrast;
spca50x->brightness = p->brightness;
spca50x->colour = p->colour;
spca50x->funct.set_bright(spca50x);
spca50x->funct.set_contrast(spca50x);
spca50x->funct.set_colors(spca50x);

spca50x->hue = p->hue;
spca50x->whiteness = p->whiteness;

return 0;
}

I thought that I would manage to solve the problem but I was not able to get the sources and appropriate patches for dd-wrt to re-build drivers from sources (spca5xx, videodev) for 2.4.35 kernel to debug it and understand what it needs.
Please could someone help me to resolve the problem? Should I put some params to the spca5xx driver or something?

Thanks
Pavel