Comment 25 for bug 8050

Revision history for this message
Thomas Hood (jdthood) wrote :

On second thought, the information that udev would use to set up the
symlinks as I described earlier is already available to applications
via /proc/asound/cards; so, introducing /dev/snd/card.<id>/ is not
really necessary. E.g., suppose an application wants to talk to a
CS46xx. Instead of trying to open /dev/snd/card.CS46xx/pcmD0p (as
I suggested) the application can look in /proc/asound/cards, find
that there is a CS46xx at index 0 and open /dev/snd/pcmC0D0p .
Alternatively, it could look for the card by card ID.

I am having doubts that we should configure udev so that it puts
card index numbers in a certain order based on card type or PCI ID.
It would be hard to make this work reliably when hot plugging is
possible. We don't want devices changing indices when other cards
are inserted or removed and that restriction makes it impossible
to guarantee that the cards are always indexed in the "appropriate"
order. Furthermore, the order that is "appropriate" depends on
which application we are thinking about.

Having said that, I do think that it would be worthwhile to do
something on behalf of the simplest sound applications which expect
to be able to play sounds by opening /dev/snd/pcmC0D0p or /dev/dsp.

Perhaps it would suffice if we made a list of drivers that drive
cards that are inherently unsuitable to be the primary sound card.
I take it that snd-bt87x is such a driver because it only does
recording, no playback. There may be others (e.g., the modems?).
For each of these drivers we could add lines like these to
/etc/mod(utils|probe.d)/alsa-base:

    options snd-bt87x index=1

so that they don't get assigned index 0.

This scheme has a weakness. If the "index" option is not used
then ALSA assigns the first available index. If the "index"
option _is_ used the ALSA does not assign the first available
index; it only tries to assign the specified index and fails
if that index is already taken. Our scheme would be better if
we could get ALSA to implement a feature like this:

    options snd-bt87x index=1-

where "1-" means "1 or higher". However, even without this
enhancement I think that excluding the drivers in question from
getting index 0 is more important than supporting systems that
have three or more sound cards.

Comments?