You are not logged in.

#1 2012-01-14 07:31:08

szim90
Member
Registered: 2011-08-01
Posts: 29

[Solved] Alsa Sound Card Numbering Not Persistant Between Boots

Hello,

I'm having trouble with alsa and my multiple sound cards. Sometimes when I boot, I get the following output from "aplay -l"

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

However, I also see this after other boots:

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

Because the card numbering is not consistant, I'm having a great deal of trouble (if the card is 0, then I don't need an asoundrc, but if it's 1, I do). It also breaks my volume panel applet for the alsa card number to often change (volumeicon - from the AUR). Is there a way to force a certain device to always be card number 0?

Thanks for any help.

-Sean

Last edited by szim90 (2012-01-15 02:01:54)

Offline

#2 2012-01-14 08:00:35

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Alsa Sound Card Numbering Not Persistant Between Boots

Have you tried https://wiki.archlinux.org/index.php/Ud … _Each_Boot ?
I think you should check in /sys/class/sound/ for the device names.

Offline

#3 2012-01-14 08:28:06

szim90
Member
Registered: 2011-08-01
Posts: 29

Re: [Solved] Alsa Sound Card Numbering Not Persistant Between Boots

Thank you for your response, karol.

I ran 'udevadm info -a -p /sys/class/sound/card1/' as was able to get the following information:

  looking at device '/devices/pci0000:00/0000:00:14.2/sound/card1':
    KERNEL=="card1"
    SUBSYSTEM=="sound"
    DRIVER==""
    ATTR{id}=="SB"
    ATTR{number}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:14.2':
    KERNELS=="0000:00:14.2"
    SUBSYSTEMS=="pci"
    DRIVERS=="snd_hda_intel"
    ATTRS{vendor}=="0x1002"
    ATTRS{device}=="0x4383"
    ATTRS{subsystem_vendor}=="0x1458"
    ATTRS{subsystem_device}=="0xa102"
    ATTRS{class}=="0x040300"
    ATTRS{irq}=="16"
    ATTRS{local_cpus}=="00000000,0000000f"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{numa_node}=="0"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

I'm completely new to writing udev rules; would the proper procedure be to write something like this:
DEVPATH=="/devices/pci0000:00/0000:00:14.2/sound/card*" ATTRS{number}="0"

or will that happen too late in the boot process (after the card has already been assigned a number)?

Perhaps it would be easier to work through alsa itself? I know I can get sound consistantly by calling out the card in asoundrc:

pcm.!default { type hw card SB }
ctl.!default { type hw card SB }

But this seems to disable dmix (software mixing). Is there a way to re-enable dmix from the asoundrc (and would that be easier than trying to work in udev)?

Regards,
Sean

Offline

#4 2012-01-14 16:36:53

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Alsa Sound Card Numbering Not Persistant Between Boots

szim90 wrote:

But this seems to disable dmix (software mixing)

Of course - use "type dmix" instead of "type hw" - see my sig for an example.

Offline

#5 2012-01-14 16:42:44

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [Solved] Alsa Sound Card Numbering Not Persistant Between Boots

Rather than mess with asoundrc, I'd advise using the index module parameter. Check here under "Multiple sound cards". Yeah it's a Gentoo guide, but that part is distro-agnostic.

Offline

#6 2012-01-15 02:01:38

szim90
Member
Registered: 2011-08-01
Posts: 29

Re: [Solved] Alsa Sound Card Numbering Not Persistant Between Boots

Gusar, thanks for your reply. Unfortunately, since two of the cards that are conflicting both use snd_hda_intel module, using the index method didn't work for assigning card numbers.

brebs wrote:

Of course - use "type dmix" instead of "type hw" - see my sig for an example.

This worked flawlessly. Thanks for the help!

P.S. In case anyone else stumbles upon this thread, the alsa documentation on dmix, which breb mentions in his asoundrc file, was very insightful. It's available here: http://www.alsa-project.org/alsa-doc/al … ugins.html

Offline

#7 2012-01-15 11:45:40

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [Solved] Alsa Sound Card Numbering Not Persistant Between Boots

szim90 wrote:

Gusar, thanks for your reply. Unfortunately, since two of the cards that are conflicting both use snd_hda_intel module, using the index method didn't work for assigning card numbers.

Ah. There's another parameter too, that can be used in this case - id. So this could work:

option snd_hda_intel id=SB index=0

I say "could" because I personally haven't tested it yet.

Offline

Board footer

Powered by FluxBB