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

James Miller gajs-f0el at dea.spamcon.org
Tue Mar 3 15:48:55 UTC 2009


Yesterday, Justin wrote:
> Yes that's exactly what you should do, then in your mythtv-setup 
> configure your cards to use /dev/BT878 and /dev/PVR150 with the priority 
> that you want. This is exactly what I do w/ my PVR-350 and AverMedia 
> A180.

Yes sir, that seems to have done the trick. As a further explanation, just 
in case anyone more clueless than myself might be trying to do something 
like this, the following. I created the file 
/etc/udev/rules.d/55-custom.rules with the content specified in my 
previous post (which I actually stole from the Ubuntu forums post link I 
supplied). Some especially relevant parts of the contents of that file are 
the phrases SYMLINK+="BT878" and SYMLINK+="PVR150". These tell the system 
to create the symlinks BT878 and PVR150 under the /dev directory, the 
other phrases in each of those two lines pointing the actual device files 
the system has associated with each card at the symlinks. At least this is 
how I understand what's going on. After rebooting (or maybe restarting the 
udev daemon?), you next go into mythsetup and delete/add your cards, 
making sure that each card is associated with the new symlinks. I had to 
manually type in the names of the symlinks since they did not appear as 
selections in the menu. I also needed to reselect video sources for the 
two cards, having essentially added them anew. Seems like it will all now 
work as needed.

Yesterday, kane.tse wrote:
> If that approach doesn't work, you may want to post the output of:
>
> udevinfo -a -p $(udevinfo -q path -n /dev/video0)
>
> ... for each of your capture devices.  That would provide the
> information required to craft appropriate udev rules.

It seems to be working fine with the information I used, kane.tse. But it 
seemed like a good idea to append your suggestion to this post in case 
someone else with different cards may be searching for information on how 
to do this. Perhaps they could post output from the command you give to 
this list in order to ask advice on crafting the needed udev rule.

Yesterday, James Crow wrote:
> 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.

Interesting to know about this alternate way of assigning capture cards to 
dev files. I've actually done something similar in a computer I have that 
has two sound cards. Seems like there are always at least two ways to 
accomplish some end when dealing with computers. Just out of curiosity, 
does this method work only with 2.6.* kernels? Not that anyone using Myth 
would use anything else. But, as I mentioned, this modprobe options method 
can be used with other types of hardware, too.

Thanks to all for the input.

James


More information about the mythtv-users mailing list