[pvrusb2] Device naming

Rafi Rubin rafi at ugcs.caltech.edu
Fri Jan 19 03:31:16 CST 2007


Just to play with the idea I wrote a simple script to demonstrate some 
proof of concept.  I will note that in some extreme cases, I'm sure 
there are people with multiple instances of one model and for them some 
unique id might be useful.  The id on the hard drive mentioned below 
seems to be a combination of a model number and serial number.

$ find /dev/video
/dev/video
/dev/video/by-model
/dev/video/by-model/Hauppauge WinTv-USB II (PAL) FM Model 40201 Rev B226_0
/dev/video/by-model/generic_0
/dev/video/by-name
/dev/video/by-name/USBVision Video_0
/dev/video/by-name/_0


Anyway the script should be attached.  I haven't really figured out the 
udev files (hoping someone else has experience).

The script gathers information about /dev/videoX from 
/sys/class/video4linux/videoX

The second video device here is a WinTV usb, which I got just to play 
with.  But one thing to note is that the driver populates some other 
interesting sysfs nodes which might be of interest.  The driver in 
question is here: http://usbvision.sourceforge.net/


I might mention, part of the reason I've been thinking about this is 
that I'd like a low latency video capture device for things like playing 
console games (stuck with just my laptop as my only tv), while its nice 
to have an actual pvr device for watching tv.

Rafi


Mike Isely wrote:
> On Thu, 18 Jan 2007, Rafi Rubin wrote:
> 
>> I'm playing with different tuners and have been thinking about the 
>> confusion of using mythtv with non-equivalent devices.  And so I was 
>> thinking it would be nice to have something generate symlinks or 
>> something to provide device names that are a bit more specific than 
>> "video0", particularly since I may not be able to garuntee the order the 
>> devices are plugged in.
>>
>> Do any of you have any experience with this sort of thing?
>>
>> Here's an nice example.  I'm not entirely sure if the /dev/disk tree is 
>> generated by the kernel, hal, udev, or some weird combination.  The 
>> point is, you get a canonical name which is specific to that particular 
>> device or partition.
>>
>> $ ls /dev/disk
>> by-id  by-label  by-path  by-uuid
>> $ ls /dev/disk/by-id
>> ata-IC25N080ATMR04-0_MRG489K4JT6LHH
>> ata-IC25N080ATMR04-0_MRG489K4JT6LHH-part1
>> ata-IC25N080ATMR04-0_MRG489K4JT6LHH-part2
>> ata-IC25N080ATMR04-0_MRG489K4JT6LHH-part3
>> ata-IC25N080ATMR04-0_MRG489K4JT6LHH-part4
>> $ ls /dev/disk/by-label
>> main  spare
> 
> Everything under /dev is generated by udev, using information gathered 
> about the underlying device.  In theory you can reprogram udev to nearly 
> any scheme imaginable.
> 
> However the problem here is that you would need some way for udev to 
> discriminate some characteristic about a "pvr" V4L device versus say a 
> dumb frame buffer device.  And unfortunately all that udev can know 
> about the to-be-created device in the case of V4L is that it's just a 
> V4L device.  The pvrusb2 device driver doesn't itself manage the device 
> mapping; it is done by the V4L core as part of the operation of any V4L 
> driver registering with the V4L subsystem.  So while you can do a lot 
> with udev to make it create all sorts of interesting device names, it 
> only works if there is some attribute that udev can key off of, and I 
> don't think such a thing is available here.
> 
> Somebody correct me if this is wrong.  I think the idea here is a good 
> one, but I don't think it is possible for V4L devices.
> 
>   -Mike
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: video_name.pl
Type: application/x-perl
Size: 1787 bytes
Desc: not available
Url : http://www.isely.net/pipermail/pvrusb2/attachments/20070119/2423dafe/video_name.bin


More information about the pvrusb2 mailing list