Sander Sweers wrote:
> On do, 2008-04-10 at 21:36 +0200, Duncan Webb wrote:
>> I wonder if there is a way to use a udev rule to rename the other devices.
>>
>> I think that it would be nicer if a device that has more than one
>> sub-device created a directory in /dev so you would end up with devices
>> like:
>> /dev/ivtv0/video
>> /dev/ivtv0/vbi
>> /dev/ivtv0/radio
>> /dev/ivtv0/audio
>> /dev/ivtv0/yuv-out or /dev/ivtv0/yuv-encode
>>
>> Then it would be easy to write udev rules that made symlinks and there
>> would be some relationship between a module name and a device.
>
> I think that should be possible. You will want to use %n which is the
> kernel device number. For example, NAME="ivtv%n/video", SYMLINK+="%k"
>
> http://ivtvdriver.org/index.php/Howto#Howto_use_udev_rules.21
> http://reactivated.net/writing_udev_rules.html
>
> If you succeed it would be great if you update the wiki how you did it.
I'll do that when time allows :(
But there is something that's bothering me and there may be a very
simple solution.
What I'm trying to do is to write a video device detection routine
method do that TV devices can be automatically configured.
By examining the modalias in /sys/class/video4linux/*/device/ it is easy
enough to determine which video device belongs to which card. Here is a
Python example:
import os, glob
d = '/sys/class/video4linux'
os.listdir(d)
devices = {}
modaliases = {}
for dev in os.listdir(d):
device = os.path.join(d, dev, 'device')
v4lmod = os.path.join(device, 'modalias')
modalias = open(v4lmod).read().strip()
v4ldevs = os.path.join(device, 'video4linux:*')
devs = glob.glob(v4ldevs)
if modalias not in modaliases:
modaliases[modalias] = devs
devices[modalias] = device
for modalias in modaliases:
print modalias, devices[modalias], modaliases[modalias]
gives on machine 1:
# python src/helpers/vg.py
pci:v00004444d00000803sv00000070sd00004000bc04sc00i00
/sys/class/video4linux/video4/device
['/sys/class/video4linux/video4/device/video4linux:video4',
'/sys/class/video4linux/video4/device/video4linux:video36',
'/sys/class/video4linux/video4/device/video4linux:vbi4',
'/sys/class/video4linux/video4/device/video4linux:video28',
'/sys/class/video4linux/video4/device/video4linux:radio4',
'/sys/class/video4linux/video4/device/video4linux:video20',
'/sys/class/video4linux/video4/device/video4linux:vbi12',
'/sys/class/video4linux/video4/device/video4linux:vbi20',
'/sys/class/video4linux/video4/device/video4linux:video52']
pci:v00001131d00007134sv000011BDsd0000002Bbc04sc80i00
/sys/class/video4linux/video0/device
['/sys/class/video4linux/video0/device/video4linux:video0',
'/sys/class/video4linux/video0/device/video4linux:vbi0']
and on machine 2:
pci:v00004444d00000016sv00000070sd0000E817bc04sc00i00
/sys/class/video4linux/video25/device
['/sys/class/video4linux/video25/device/video4linux:video25',
'/sys/class/video4linux/video25/device/video4linux:vbi1',
'/sys/class/video4linux/video25/device/video4linux:video33',
'/sys/class/video4linux/video25/device/video4linux:video1']
pci:v00004444d00000016sv00000070sd0000E807bc04sc00i00
/sys/class/video4linux/radio0/device
['/sys/class/video4linux/radio0/device/video4linux:radio0',
'/sys/class/video4linux/radio0/device/video4linux:video24',
'/sys/class/video4linux/radio0/device/video4linux:vbi0',
'/sys/class/video4linux/radio0/device/video4linux:video32',
'/sys/class/video4linux/radio0/device/video4linux:video0']
pci:v0000109Ed00000350sv00000000sd00000000bc04sc00i00
/sys/class/video4linux/vbi2/device
['/sys/class/video4linux/vbi2/device/video4linux:vbi2',
'/sys/class/video4linux/vbi2/device/video4linux:video2']
The details of what driver handles what device is easy but there does
not seem to be any way that I can find out that what /dev/videoX does.
Comparing the output from:
v4l2-ctl --all --device=/dev/video4
and
v4l2-ctl --all --device=/dev/video20
and
v4l2-ctl --all --device=/dev/radio4
output is exactly the same information but the functionality of the
devices is quite different.
My problem is there doesn't seems to be no way to determine which device
does what without knowing the specific details of the card.
So the question is: is there a way to know that on machine 1 /dev/video0
writes a YUV stream and /dev/video4 writes a MPEG2 and on machine 2
/dev/video0 and /dev/video1 write MPEG streams and /dev/video2 writes a
YUV stream? Or that /dev/video20 reads a MPEG stream?
TIA
Duncan
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel