[pvrusb2] How to uniquely identify a device

Mike Isely isely at isely.net
Fri Jan 9 16:21:48 CST 2009


On Fri, 9 Jan 2009, Carsten Meier wrote:

> Am Fri, 9 Jan 2009 14:27:43 -0600 (CST)
> schrieb Mike Isely <isely at isely.net>:
> 
> > On Fri, 9 Jan 2009, Carsten Meier wrote:
> > 
> > > Hi again,
> > > 
> > > I'm currently writing a tool to store video-settings in an XML-file
> > > (for setting controls on a per-channel basis and for storing
> > > encoding-profiles). Now I have a problem to uniquely identify a
> > > device. I first wanted to use the bus-info to associate a
> > > particular device with a profile (for the case of multiple
> > > identical devices connected to a system). But this changes on
> > > reconnect.
> > > 
> > > If I first print out the bus-info it reports something like "usb 7-2
> > > address 7". If I then dis- and reconnect the device while it is
> > > under operation (streaming to VLC), it creates a new device-node
> > > (/dev/video1 here, exactly what it should do) but reports a
> > > bus-info "usb 7-2 address 8" and the profile can't be associated to
> > > that device. How can I read the serial-number which is used by the
> > > sysfs-interface through the V4L2-API?
> > 
> > Unfortunately the serial number is not available through the V4L2
> > API. Last time I researched this (years ago) I could find no legal
> > way to do this - without defining/abusing a custom V4L control to
> > read it back. Perhaps that's better now; if you'd like to suggest
> > something I'll listen.  As for the bus info, that's really supposed
> > to be about "where" the device is, not "who" the device is :-(
> > 

> If the bus-info is supposed to describe "where" the device is (from a
> users perspective, not something like kernel-usb-instances), shouldn't it
> report back the same string if I replug it to same port? Then the config
> settings remain valid for that device and the user can simply
> distinguish devices by the place where they are plugged in. (as he
> already does with PCI cards)

Nice idea, but the concept of "where" in USB-land is also a logical 
thing.  It indicates an assigned USB address relative to the hub not 
just the physical port.  This (IMHO) makes the information useless to 
just about everyone except someone debugging the USB core.  Fun, eh?

I believe for V4L, the bus info concept comes from PCI, where the idea 
of "where" (bus #, device #, function #) is a little more concrete and 
can't change so long as the card is always put into the same slot.

For what you're trying to do, you really want an identifier tied to the 
device itself not where it happens to be residing at the moment.  That 
technically is more the "USB way" of doing things anyway.  And that's 
the serial number...

  -Mike


-- 

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


More information about the pvrusb2 mailing list