[pvrusb2] getting at the serial number

Mike Isely isely at isely.net
Fri Jan 16 22:30:21 CST 2009


Carsten:

I just learned something interesting that you'll want to know.  The 
serial number *is* in fact already available in the USB configuration 
data.  Thus you can do what Mauro is suggesting to identify the device: 
Use the bus_info field to find the udev-populated device node in /sys 
and then walk that to find the serial number.

The reason I had never considered this is because the device's serial 
number is stored in its ROM, encoded in a format that is specific to 
Hauppauge and has nothing to do with USB.  The pvrusb2 driver reads this 
by using the tveeprom module to parse the data.  Since the pvrusb2 
driver then never does anything with the result except to use it as the 
root node in its own sysfs interface, I had concluded that it wasn't 
available any other way.

However it is in fact present in the USB configuration data.  Just run 
the usbview generic tool and you'll see it.  You'll see a field labeled 
"Serial Number:" and its value will be of the form "mmmm-xx-yyyyyyyy".  
The "mmmm" appears to match the model type, but the "yyyyyyyy" is an 8 
digit hex number that when converted to decimal will match the number 
that the pvrusb2 driver puts in its sysfs interface.  (The "xx" part 
appears to just be a pair of constant zeroes.)

Why is this?  Well I can't prove it, but I can think of two 
possibilities for how the serial number could have found its way into 
the USB configuration data without any help from the pvrusb2 driver:

First the USB config data is also in that ROM - this is where the 
manufacturer and device ID are initially coded of course.  But that's a 
different part of the ROM, formatted in a manner that the FX2 
processor's factory ROM initialization can directly read, i.e. this part 
is not specific to Hauppauge.  So it's possible that the serial number 
is actually written in two places.

A second possibility is that the FX2 is able to directly reinitialize 
its USB interface as it comes up.  It can write its own configuration 
data.  So it's theoretically possible that the Hauppauge-supplied FX2 
firmware is itself accessing the nearby Hauppauge ROM, extracting the 
serial number, and then stuffing it in to the USB configuration data.  
However until now I've never seen any actual evidence that the FX2 
firmware will directly read that ROM (rather, the host driver reads it).

But either way that would explain things.

  -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