[mythtv-users] Example IVTV Udev rules

Mark Paulus mark.paulus at verizonbusiness.com
Fri Nov 17 21:32:00 UTC 2006


I had a go at this for my system.  However, I wanted something a bit 
more generic, since I might be swapping cards around, so, here's what I 
came with:

/etc/udev/rules.d/z90ivtv.rules:
-------------------------------------------------------------------
KERNEL=="video?", ATTR{name}=="ivtv? encoder MPEG", 
PROGRAM="/usr/local/bin/v4ldev_namer ivtv", SYMLINK+="%c"

/etc/udev/rules.d/z90bttv.rules:
-------------------------------------------------------------------
KERNEL=="video?", DRIVERS=="bttv",  PROGRAM="/usr/local/bin/v4ldev_namer 
bttv_vid", SYMLINK+="%c"
KERNEL=="vbi?", DRIVERS=="bttv",  PROGRAM="/usr/local/bin/v4ldev_namer 
bttv_vbi", SYMLINK+="%c"
KERNEL=="audio?", DRIVERS=="Bt87x", 
PROGRAM="/usr/local/bin/v4ldev_namer bttv_aud", SYMLINK+="%c"
KERNEL=="dsp?", DRIVERS=="Bt87x",  PROGRAM="/usr/local/bin/v4ldev_namer 
bttv_dsp", SYMLINK+="%c"

and the simple "heart of the system":
/usr/local/bin/v4ldev_namer
-------------------------------------------------------------------
#!/bin/bash

files=`ls -1 /dev/${1}* 2>/dev/null`
for i in $files
do
     devnbr=${i##/dev/${1}}
done
if  [ -z $devnbr ]; then
     devnbr=0
else
     devnbr=$((devnbr+1))
fi

echo ${1}${devnbr}

This creates entries like:
/dev/ivtv0
/dev/bttv_vid0
/dev/bttv_aud0
/dev/bttv_dsp0
/dev/bttv_vbi0

where the bttv_vidx is dependant upon which bttv card this is, not which 
/dev/videox device, which would seem to flip-flop willy-nilly on my 
system.  So, now I can use /dev/bttv_vid0 or /dev/ivtv0 in mythtv-setup, 
instead of relying on the highly volatile /dev/video0/1/2/x.

Derek Meek wrote:
> you found a bug in my rules for me!  my initial rules need a name line -
> they were too lax before
> 
> DRIVER=="ivtv", SYSFS{name}=="ivtv? encoder MPEG", ID=="0000:02:08.0",
> SYMLINK+="pvr_500_1"
> DRIVER=="ivtv", SYSFS{name}=="ivtv? encoder MPEG", ID=="0000:02:09.0",
> SYMLINK+="pvr_500_2"
> DRIVER=="ivtv", SYSFS{name}=="ivtv? encoder PCM audio",
> ID=="0000:02:08.0", SYMLINK+="pvr_500_1_audio"
> DRIVER=="ivtv", SYSFS{name}=="ivtv? encoder PCM audio",
> ID=="0000:02:09.0", SYMLINK+="pvr_500_2_audio"
> 
> Mark Paulus wrote:
>> Thanks.  This will help me with a problem where my bttv and my PVR-150
>> seem to flip/flop depending upon which kernel I load.  Now I can keep
>> them straight......
>>
>> (Think I'm gonna need to create an additional symlink for the audio
>> part of the bttv card, tho)
>>
>>
>>
>> Derek Meek wrote:
>>> I finally took the time to sit down and figure out udev rule writing and
>>> I figured I'd share the results with you.
>>>
>>> DRIVER=="ivtv", ID=="0000:02:08.0", SYMLINK+="pvr_500_1"
>>> DRIVER=="ivtv", ID=="0000:02:09.0", SYMLINK+="pvr_500_2"
>>>
>>> ID is the PCI bus ID from the device
>>> IE
>>> 02:08.0 Multimedia video controller: Internext Compression Inc iTVC16
>>> (CX23416) MPEG-2 Encoder (rev 01)
>>> 02:09.0 Multimedia video controller: Internext Compression Inc iTVC16
>>> (CX23416) MPEG-2 Encoder (rev 01)
>>>
>>> matches the above devices
>>>
>>> this will create the symlinks /dev/pvr_500_1 and /dev/pvr_500_2
>>> corresponding to each head of the PVR-500 so i don't have to worry
>>> about /dev/videoN jumping around (which has been a problem in the past)
>>>
>>> when my 150 arrives it'll be
>>>
>>> DRIVER=="ivtv", ID="0000:whatever", SMYLINK+="pvr_150"
>>>
>>> I hope this is helpful
>>> PS a udev rule for my bttv card would be
>>> DRIVER="bttv", ID="0000:00:08.0", SYMLINK+="shitty_cable_box_slaver"
>>>
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>   
> 
> 

-- 
Mark Paulus
2424 Garden of the Gods Rd  | Phone:  v622-5578 / 719-535-5578
0419/117 - LEC Access ; D5-1010   | FAX:    719-535-1665
Colo Springs, CO  80919    | 1800PageMCI / 1406052
AIM : mgpaulus1    /  sametime : mark.paulus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mark.paulus.vcf
Type: text/x-vcard
Size: 296 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20061117/fad02c3f/attachment.vcf 


More information about the mythtv-users mailing list