Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2011 14:15:48 -0800
From:      Kevin Baxter <voidchicken@gmail.com>
To:        freebsd-multimedia@freebsd.org
Subject:   Webcamd and the au0828
Message-ID:  <AANLkTin7M7H2X0zj3p6Rp2PMEZ2GsUrbohqwm1CKvwmd@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I've been trying to get my au0828-based stick (a Hauppauge 950Q to be
specific) to work in webcamd. Here's the list of problems and solutions I've
hit so far.

The first thing I discovered (that took embarrassingly long to realize) what
that the au0828 drivers weren't in the Makefile. No wonder it didn't detect
the stick. The full list of stuff to add to make it all link:
SRCS+= au0828-cards.c
SRCS+= au0828-core.c
SRCS+= au0828-dvb.c
SRCS+= au0828-i2c.c
SRCS+= au0828-vbi.c
SRCS+= au0828-video.c
SRCS+= au8522_dig.c #strange that it needs this one

Funnily enough, au8522_decoder.c isn't needed. Which is good because that
file depends on two functions which webcamd doesn't implement:
i2c_register_driver and i2c_del_driver. Sorry au8522 fans.

Once those were in, it wanted the header i2c-algo-bit.h. From what I can
tell it doesn't actually USE it, but the easy solution was just to grab a
copy out of the Linux source and drop it into headers/linux/

Third was a linker error looking for a function called irqs_disabled(). It
took me a few hours of source digging before I realized that all this stuff
would be running in userspace and irqs_disabled() would always be 0. Then I
noticed that it's in the svn already. But an upstream driver change broke
the svn, so I'm working with the copy in ports.

So now it builds and links. It loads the driver, detects the stick, attaches
it to cuse, and then segfaults.

#0  0x000000000040a233 in v4l2_device_register (dev=0x8012d0f70,
    v4l2_dev=0x8012ffae0)
    at
/usr/ports/multimedia/webcamd/work/webcamd-0.1.18/v4l-dvb/linux/drivers/media/video/v4l2-device.c:47

#1  0x00000000004d87f1 in au0828_usb_probe (interface=0x8012d0f70,
id=0x6fc840)
    at
/usr/ports/multimedia/webcamd/work/webcamd-0.1.18/v4l-dvb/linux/drivers/media/video/au0828/au0828-core.c:215

#2  0x0000000000407c4e in usb_linux_probe_p (p_bus=0x736ab0,
p_addr=0x736ab4,
    p_index=0x736ab8)
    at
/usr/ports/multimedia/webcamd/work/webcamd-0.1.18/kernel/linux_usb.c:415
#3  0x00000000004dd90f in main (argc=-5952, argv=0x7fffffffe9e0)
    at webcamd.c:482

For reference, v4l2-device.c:47
snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s",
    dev->driver->name, dev_name(dev));

dev (struct usb_device.device) is allocated as part of the usb_device
structure way over in linux_usb.c:usb_linux_create_usb_device. The
usb_device structure is zeroed out when it's allocated, and the device
member is never populated. So v4l2-device.c goes and dereferences a null
pointer when it does dev->driver.

At this point I've hit the limits of my abilities. I'm better at reading
code than writing it :) I suppose the way to do it would be to allocate a
little extra more in usb_linux_create_usb_device for p_ud->dev.driver and
set p_ud->dev.driver->name = "".

The icing on the cake is that webcamd doesn't link compiled with -O0. Makes
gdb more interesting.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTin7M7H2X0zj3p6Rp2PMEZ2GsUrbohqwm1CKvwmd>