[mythtv-users] /dev/video0 and /dev/video1 occasionally swapped on reboot: udev rule needed?

James Crow james at ultratans.com
Tue Mar 3 12:58:19 UTC 2009


On Mon, 2009-03-02 at 12:18 -0600, James Miller wrote:
> earlier today, James Miller wrote:
> 
> > Can I ask for input on creating the udev rules I will need in order for 
> > the device files representing my capture cards get assigned consistently
> > each time I boot the system? TIA.
> 
> Some further searching on this issue turned up the following link: 
> http://ubuntuforums.org/archive/index.php/t-950387.html . This is one of 
> those extremely rare occasions where you find that someone online has 
> tried to do the same thing you want to do and, what's more, has 
> essentially the same system setup (he also uses Mythbuntu and has the same 
> capture cards I'm using). His udev rule is named 
> /etc/udev/rules.d/55-custom.rules and the content is as follows:
> 
> KERNEL=="video[0-9]", SYSFS{name}=="BT878*", SYMLINK+="BT878"
> KERNEL=="video[0-9]", SYSFS{name}=="ivtv*", SYMLINK+="PVR150"
> 
> Does that look it's going to accomplish the goal I'm  aiming at, i.e., to 
> ensure that my capture cards are assigned device files consistently 
> between reboots? Seems promising. Any further helpful input on this issue?
> 
> Thanks,
> James

An alternate method is to pass the video device number to each driver.
In /etc/modprobe.d/options add these lines:

options ivtv ivtv_first_minor=0
options bttv video_nr=1

That will cause the ivtv driver to always grab /dev/video0 and the bttv
driver to always grab /dev/video1. If you have more than one device that
uses either driver it could cause problems. On my system I have a
Pinnacle 800i (ATSC/QAM and frame grabber) and a PVR-500 which will grab
two video devices. This is an example from mine:

root at mythfront:~# ls /dev/vide*
ls: cannot access /dev/vide*: No such file or directory
root at mythfront:~# modprobe -v ivtv ivtv_first_minor=4
insmod /lib/modules/2.6.27-11-generic/kernel/drivers/media/video/ivtv/ivtv.ko ivtv_first_minor=4
root at mythfront:~# ls -l /dev/video*
crw-rw----+ 1 root video 81, 28 2009-03-03 07:41 /dev/video28
crw-rw----  1 root video 81, 29 2009-03-03 07:41 /dev/video29
crw-rw----+ 1 root video 81, 36 2009-03-03 07:41 /dev/video36
crw-rw----  1 root video 81, 37 2009-03-03 07:41 /dev/video37
crw-rw----+ 1 root video 81,  4 2009-03-03 07:41 /dev/video4
crw-rw----  1 root video 81,  5 2009-03-03 07:41 /dev/video5
root at mythfront:~# modprobe -v cx8800 video_nr=2
insmod /lib/modules/2.6.27-11-generic/kernel/drivers/media/video/cx88/cx8800.ko video_nr=2
root at mythfront:~# ls -l /dev/vide*
crw-rw----  1 root video 81,  2 2009-03-03 07:42 /dev/video2
crw-rw----+ 1 root video 81, 28 2009-03-03 07:41 /dev/video28
crw-rw----+ 1 root video 81, 29 2009-03-03 07:41 /dev/video29
crw-rw----+ 1 root video 81, 36 2009-03-03 07:41 /dev/video36
crw-rw----+ 1 root video 81, 37 2009-03-03 07:41 /dev/video37
crw-rw----+ 1 root video 81,  4 2009-03-03 07:41 /dev/video4
crw-rw----+ 1 root video 81,  5 2009-03-03 07:41 /dev/video5
root at mythfront:~# 

So passing the ivitv_first_minor option to ivtv makes it grab
that /dev/video[number]. Most other drivers seem to support the video_nr
options which does the same thing.

Cheers,
James




More information about the mythtv-users mailing list