Comment 58 for bug 577727

Revision history for this message
jhansonxi (jhansonxi) wrote :

Note that in Brebs' fix this line:

pcm "hw:0,0"

is a card number of a hardware sound device on HIS system. The number may change at discovery because of udev (http://alsa.opensrc.org/MultipleCards), especially if a USB sound device is added or removed, making the .asoundrc configuration use the wrong device.

To identify current sound devices and related modules:

while read sdmod; do grep "^[[:space:]]$(echo "$sdmod" | sed -n 's/^\([[:digit:]]\+\)\([^[:digit:]]\+.*\)/\1/p')[[:space:]]" /proc/asound/cards ; echo " $sdmod" ; done</proc/asound/modules

For example, the result on my system is:
0 [SB ]: HDA-Intel - HDA ATI SB
 0 snd_hda_intel
 1 [U0x46d0x8cc ]: USB-Audio - USB Device 0x46d:0x8cc
 1 snd_usb_audio
 2 [HDMI ]: HDA-Intel - HDA ATI HDMI
 2 snd_hda_intel

Another way to identify the device is with "aplay -l" (aplay is in the alsa-utils package):

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The value in brackets from /proc/asound/cards (or the value after the card number and before the bracketed value from aplay -l) is the ID of the device which can be used in place of the card number. So the pcm slave device for the pcm.doom3 entry on my system is:

pcm "hw:SB"

The device can be permanently assigned via /etc/asound but to prevent the device IDs from changing the ID must be set in the options for the module in /etc/modprobe.d using "index=#" where # starts at 0. Use "modinfo -p <module_name>" for a list of parameters. Normally device 0 is the default. The "slots=" option is another possibility but may only work with USB devices.

A custom udev rule can also be used: http://alsa.opensrc.org/Udev