Re: multiple em28xx devices doesn't work (well)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello there,

On Fri, Jun 6, 2008 at 7:10 PM, Sneake <2hteq3r02@xxxxxxxxxxxxxx> wrote:
> I have 2 em28xx USB capture devices - a Hauppauge Win-HVR-950 and a Pinnacle HD stick:
>
> Bus 001 Device 007: ID 2304:0227 Pinnacle Systems, Inc. [hex] Pinnacle TV for Mac, HD Stick
> Bus 001 Device 004: ID 2040:6513 Hauppauge
>
> Both of which are em28xx devices.
> I am running the latest HG pull of the v4l-dvb drivers as of today (6th June 2008).
>
> From a cold start, both devices are seen by the USB probe, however only one gets a /dev/dvb
> /adapter entry. If I remove the one that did not, I get the following warning:

I was able to reproduce the behavior you were seeing (I actually have
the exact same two devices).

Attached is a patch that will address the problem (based off of the
latest hg).  There was a race condition in the module loading process
which caused only the last device to be initialized by the driver.

I will submit the patch to Mauro for inclusion.

Thanks for your help,

Devin

-- 
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller
From: Devin Heitmueller <devin.heitmueller@xxxxxxxxx>

em28xx-video.c
 - Properly handle loading of the module when multiple devices are already
   connected (such as at bootup).  Before we were only calling dvb_init() 
   against the last device in the list, so while we were handling subsequent
   adds properly, if there were multiple devices present on driver load, 
   everybody except the last device would not get initialized.

Signed-off-by: Devin Heitmueller <devin.heitmueller@xxxxxxxxx>

diff -r 3f7d664a285d linux/drivers/media/video/em28xx/em28xx-video.c
--- a/linux/drivers/media/video/em28xx/em28xx-video.c	Sun Jun 08 07:26:00 2008 -0300
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c	Sun Jun 08 21:17:12 2008 -0400
@@ -1934,32 +1934,28 @@ static DEFINE_MUTEX(em28xx_extension_dev
 
 int em28xx_register_extension(struct em28xx_ops *ops)
 {
-	struct em28xx *h, *dev = NULL;
-
-	list_for_each_entry(h, &em28xx_devlist, devlist)
-		dev = h;
+	struct em28xx *dev = NULL;
 
 	mutex_lock(&em28xx_extension_devlist_lock);
 	list_add_tail(&ops->next, &em28xx_extension_devlist);
-	if (dev)
-		ops->init(dev);
-
+	list_for_each_entry(dev, &em28xx_devlist, devlist) {
+		if (dev)
+			ops->init(dev);
+	}
 	printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
 	mutex_unlock(&em28xx_extension_devlist_lock);
-
 	return 0;
 }
 EXPORT_SYMBOL(em28xx_register_extension);
 
 void em28xx_unregister_extension(struct em28xx_ops *ops)
 {
-	struct em28xx *h, *dev = NULL;
+	struct em28xx *dev = NULL;
 
-	list_for_each_entry(h, &em28xx_devlist, devlist)
-		dev = h;
-
-	if (dev)
-		ops->fini(dev);
+	list_for_each_entry(dev, &em28xx_devlist, devlist) {
+		if (dev)
+			ops->fini(dev);
+	}
 
 	mutex_lock(&em28xx_extension_devlist_lock);
 	printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux