[pvrusb2] Is it possible to discriminate between two HVR-1950s?

Mike Isely isely at isely.net
Tue Apr 13 19:15:14 CDT 2010


OK, here's the answer.  I had forgotten one detail in my first answer a 
few days ago.  Since then I've traced back through the source code to be 
sure and can describe the entire thing here.  So...

My original statement was correct by itself - the udev daemon is able to 
see the serial number because it's part of the USB configuration data.  
But there's a catch - and that catch is that video0 (or whatever) is 
*not* the USB device.  Rather, that's the video device.  The actual USB 
device node is something different.

The pvrusb2 driver is technically dealing with two device nodes.  One is 
the USB device node that is the pvrusb2-driven hardware.  It's a pure 
USB thing, and is logically the point through which the driver 
communicates with the actual hardware.  But that node is of course 
useless for a video capture app.  So therefore we have that other device 
node, video0 (or video1 or video2 or whatever).  The pvrusb2 driver 
causes the video device node to be created and its job basically is to 
act on whatever API requests come from that video node and do something 
through that other USB node to operate the device in an attempt to 
satisfy the request.  That's of course horribly oversimplified but it is 
the logical structure.

So, if you use udevadm info to directly inspect the USB device node 
you'll see the serial number.  Obviously that's not good enough from the 
point of view of the video device node.  Read on...

Back on 19-Sep-2009 I implemented a minor change to the pvrusb2 driver 
that causes the video device node to be logically associated with the 
USB device node.  With that change, the USB device node becomes the 
"parent" of the video device node.  And this solves the problem.  With 
the relationship established, udev will see the relationship and will 
know how to automagically traverse up to the USB device node where the 
juicy serial number is residing.  This is why some of you are seeing 
just a little data while others are seeing a lot more - it depends on 
whether or not you are using a version of the pvrusb2 driver that 
includes the implementation for associating the device nodes.

The change that fixes this went into the 20090919 standalone pvrusb2 
driver release.  Concurrent with that the change was made available to 
the v4l-dvb Mercurial repository and was pulled into it a few days 
later.  That in turn causes the change to be staged for the next merge 
window for the kernel mainline.  The change should definitely be in 
2.6.33.x but it may also be in 2.6.32.x - I don't remember exactly when 
that merge window opened.  If you examine the driver source for this, 
edit drivers/media/video/pvrusb2/pvrusb2-v4l2.c and search for a line 
that looks like this:

	dip->devbase.dev = &usbdev->dev;

If you see that line, then the driver should be establishing the 
association that you need in order for udev to see its serial number.

So, to summarize this, in order to see the serial number in udev, you 
need to be running a pvrusb2 driver that contains the change for this 
made on 19-Sep-2009; the standalone driver snapshot of that date (which 
anyone can use) definitely has this change, I am reasonably sure it's 
also in 2.6.33.x and it may also be in 2.6.32.x as well.

Hope that helps.

  -Mike

-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8


More information about the pvrusb2 mailing list