[mythtv-users] Anyone good with udev rules?

kanetse@gmail.com kane.tse at gmail.com
Wed Sep 13 20:01:38 UTC 2006

I just did this recently, trying to piece together the info from the
mailing list and websites, and here is what I worked out.

1. In your current system, do a udevinfo on each of your video devices.

udevinfo -a -p $(udevinfo -q path -p /class/video4linux/video1)

I'll use /dev/video1, since that's my bttv card, so udevinfo should
spit out something like this:

udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

  looking at device '/class/video4linux/video1':
    SYSFS{name}=="BT878 video _ATI TV-Wonder_"

  looking at device '/devices/pci0000:00/0000:00:09.0':

  looking at device '/devices/pci0000:00':

2. Repeat this step with all your other /dev/video devices:

udevinfo -a -p $(udevinfo -q path -p /class/video4linux/video0)
udevinfo -a -p $(udevinfo -q path -p /class/video4linux/video1)
udevinfo -a -p $(udevinfo -q path -p /class/video4linux/video2)

3. Now, pick and choose values that are unique to each card from this
output.  So, in the case of my bttv card, it has a value of:


... which the other (IVTV) cards in my system don't have these values.
So that is a unique key by which udev can identify by bttv card.  I
also used the KERNEL="video?" and BUS=="pci", because I wanted to
ensure that I was symlinking the video (i.e. /dev/video*) part of my
bttv card, the video cards also have a vbi component and even a dsp

So, my udev rule will look like this (should only be on one line, may
be word-wrapped due to 80 column email restriction)

KERNEL=="video?", BUS=="pci", SYSFS{subsystem_vendor}=="0x1002",
SYSFS{subsystem_device}=="0x0001", SYMLINK+="video-atitv"

4. Now I go to /etc/udev/rules.d/ and create a blank file called
11-video.rules and paste that line into the file.

5. Reboot.  (Maybe there is another way to get udev to pick up the
rules, the command supplied in the URL isn't installed in my FC5)

6. Do an ll /dev/video*, and I will see a symbolic link pointing from
/dev/video-atitv to /dev/video1.  Obviously, it will depend on which
/dev/video device the bt8x8 got assigned to.

7. Go into MythTV setup and configure your software-based tuner card
to point to /dev/video-atitv instead of /dev/video1.  You have to type
"/dev/video-atitv" in manually; you can't scroll to it with the arrow

You can do this with sound cards and VBI too.  Here's what my
11-video.rules looks like:

KERNEL=="video?", BUS=="pci", SYSFS{subsystem_device}=="0x4009",
KERNEL=="video?", BUS=="pci", SYSFS{subsystem_vendor}=="0x1002",
SYSFS{subsystem_device}=="0x0001", SYMLINK+="video-atitv"
KERNEL=="video?", BUS=="pci", SYSFS{subsystem_device}=="0xe807",
SYSFS{subsystem_vendor}=="0x0070", SYMLINK+="video-pvr500-1"
KERNEL=="video?", BUS=="pci", SYSFS{subsystem_device}=="0xe817",
SYSFS{subsystem_vendor}=="0x0070", SYMLINK+="video-pvr500-2"
KERNEL=="vbi?", BUS=="pci", SYSFS{subsystem_vendor}=="0x1002",
SYSFS{subsystem_device}=="0x0001", SYMLINK+="vbi-atitv"

Currently, my set up works.  But the real irony is that since I wrote
these udev rules, my cards stopped shifting position!

Anyway, this is only a rough guide.  For more a detailed explanation,
you should still consult the URLs provided in the other messages.

More information about the mythtv-users mailing list