From owner-freebsd-multimedia@FreeBSD.ORG Thu Jan 13 22:38:31 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7967E106566B for ; Thu, 13 Jan 2011 22:38:31 +0000 (UTC) (envelope-from voidchicken@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 2D6E88FC12 for ; Thu, 13 Jan 2011 22:38:31 +0000 (UTC) Received: by qyk8 with SMTP id 8so5179684qyk.13 for ; Thu, 13 Jan 2011 14:38:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=RDLrR/uCjgOneegqREi7Fqlz395DOHJdjqxZxPoHCs0=; b=xG+hg4xqdBkXl+zOWBz8j/7Vtqa3CrkxFBOWsoHS0z7SExOy4Uop9FzL8Q3Lr3i4e+ tTmlogS2e6cFXSdHr7ffC1ai9FWeLs0EpxCYu38ZznReT+nu2F3uIOVeNhVf2/GD9SOD KD4pUrzdlRgRji/QPbZGaXun945cUevfUNHAM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=LDf7jBJecPx2mfoSvebDIIolFRzoJcOtVwdVZ6HAiJGN5/deT6ExoSdSlbd6J0laYM c8l0+Cj6mxFKcMxNX/LYAvc1oAQzWlGTyfWoVWxoQQyKza6C15WmmbavZiTphin6YL+I ehpVpmt18NK/XIdZBAv8yjNOpruyaViwtVR9Y= MIME-Version: 1.0 Received: by 10.229.247.212 with SMTP id md20mr2361262qcb.272.1294956948507; Thu, 13 Jan 2011 14:15:48 -0800 (PST) Received: by 10.220.202.130 with HTTP; Thu, 13 Jan 2011 14:15:48 -0800 (PST) Date: Thu, 13 Jan 2011 14:15:48 -0800 Message-ID: From: Kevin Baxter To: freebsd-multimedia@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Webcamd and the au0828 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2011 22:38:31 -0000 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.