Problems with multiple cards of the same type

The biggest obstacle of getting my two sound cards working nicely together was actually to keep the order of the cards the same between reboots of my Gentoo Linux box. Once I thought, I had everything configured correctly after the next reboot the two cards had switched positions again, with the mixer portion of the TV additionally disturbing things. I experienced similar things with my PVR and analog TV cards. Most of the time the analog TV card would be /dev/video1, but 1 out of 10 boots it would be initialized as /dev/video0.

I found the solution for my sound cards in this thread on the Gentoo forum. For this to work correctly at least these versions of the below packages are required:

>=baselayout-1.12.9
>=module-init-tools-3.2.2-r2
>=udev-104-r9

The three soundcards are blacklisted in the file /etc/modprobe.d/blacklist:

blacklist snd-via82xx
blacklist snd-emu10k1
blacklist snd-bt87x

In /etc/modules.d/alsa the cards are configured this way (the index argument being the important one and the settings are incorporated into the file /etc/modules.conf by executing modules-update):

alias snd-card-0 snd-via82xx
options snd-via82xx dxs_support=1 index=0
alias snd-card-1 snd-emu10k1
options snd-emu10k1 index=1
alias snd-card-2 snd-bt87x
options snd-bt87x index=2

And finally the required sound card modules are loaded via /etc/modules.autoload.d/kernel-2.6, which contains

snd-via82xx
snd-emu10k1
snd-bt87x

I actually think, that the index-options for sound card modules don’t really have an effect. During the various test reboots the resulting card configuration didn’t really fit with the setup in the files. Only when they were loaded via /etc/modules.autoload.d/kernel-2.6 the card order was correct.

I fixed the situation with the TV cards differently. Here I created some local rules in the file /etc/udev/rules.d/10-local.rules.

KERNEL=="radio*", SYSFS{name}=="*radio*bt878*", SYMLINK+="radio" 
KERNEL=="radio*", SYSFS{name}=="*radio*bt878*", SYMLINK+="bttvradio"
KERNEL=="video*", SYSFS{name}=="*video*bt878*", SYMLINK+="bttvvideo"
KERNEL=="vbi*", SYSFS{name}=="*vbi*", SYMLINK+="bttvvbi"
KERNEL=="radio*", SYSFS{name}=="ivtv0 encoder radio", SYMLINK+="ivtvradio"
KERNEL=="video*", SYSFS{name}=="ivtv0 encoder MPEG", SYMLINK+="ivtvvideo"
KERNEL=="video*", SYSFS{name}=="ivtv0 encoder PCM audio", SYMLINK+="ivtvpcmaudio"
KERNEL=="vbi*", SYSFS{name}=="ivtv0 encoder VBI", SYMLINK+="ivtvvbi"

I then access each of the cards through the symbolic links, which always point to the correct hardware.

In retrospective this whole mess startet, when udev-1.0x was declared stable. This version provided “coldplug” functionality, that is the udev subsystem loaded the modules for all the hardware recognized by the kernel.

I’m wondering, how other distributions are handling this. Or is Gentoo the first to actually use udev-1.xx?

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax