[pulseaudio-discuss] Two identical USB sound-cards - second card fails to load because card-name found in hashmap.

Ivar Mossin ivar.mossin at gmail.com
Sat Aug 21 12:51:17 PDT 2010


Hello.

I'm having problems loading two identical sound-cards in my computer. I'm
using Ubuntu 9.10 and PulseAudio 0.9.19 coming with this release.

I have tried looking at the logs, and when using loglevel 4 I find these
lines:
<pulseaudio-discuss at mail.0pointer.de>
(first card - failing scenario):
Aug  9 22:53:08 ivar-laptop pulseaudio[2573]: module.c: Loaded
"module-alsa-card" (index: #24; argument: "device_id="1"
name="usb-BeAutiful_Qing_Audioengine_AW1-00"
card_name="alsa_card.usb-BeAutiful_Qing_Audioengine_AW1-00" tsched=yes
ignore_dB=no card_properties="module-udev-detect.discovered=1"").

(second card - failing scenario):
Aug  9 22:58:32 ivar-laptop pulseaudio[2573]: module.c: Failed to load
module "module-alsa-card" (argument: "device_id="2"
name="usb-BeAutiful_Qing_Audioengine_AW1-00"
card_name="alsa_card.usb-BeAutiful_Qing_Audioengine_AW1-00" tsched=yes
ignore_dB=no card_properties="module-udev-detect.discovered=1""):
initialization failed.


I downloaded the source-code using 'apt-get source pulseaudio' and was
looking around a bit. What I found was that the pa__init() function in
modules/alsa/module-alsa-card.c called a function pa_card_new() located in
pulsecore/card.c which returned a null-pointer. This function again called
pa_namereg_register() in pulsecore/namereg.c which returned NULL because it
could find the card-name in the hashmap and the fail argument was set to
TRUE. As a simple test, I changed the fail argument to FALSE, and the second
module loaded as well:

(first card - working scenario):
Aug 21 18:10:03 ivar-laptop pulseaudio[3835]: module.c: Loaded
"module-alsa-card" (index: #18; argument: "device_id="2"
name="usb-BeAutiful_Qing_Audioengine_AW1-00"
card_name="alsa_card.usb-BeAutiful_Qing_Audioengine_AW1-00" tsched=yes
ignore_dB=no card_properties="module-udev-detect.discovered=1"").

(second card - working scenario):
Aug 21 18:12:37 ivar-laptop pulseaudio[3835]: module.c: Loaded
"module-alsa-card" (index: #19; argument: "device_id="3"
name="usb-BeAutiful_Qing_Audioengine_AW1-00"
card_name="alsa_card.usb-BeAutiful_Qing_Audioengine_AW1-00" tsched=yes
ignore_dB=no card_properties="module-udev-detect.discovered=1"").


Having this flag set to TRUE basically disables the functionality further
down in the pa_namereg_register() which tries to add a ".%u" to the
card-name, where %u starts at 2 and gives up at 99. Trying to figure out
where this flag was set, I found that it had been set by a function
set_card_name() called further up in pa__init(). If the module being loaded
has the argument "card_name" or "name", then data->namereg_fail is set to
TRUE. Looking at the arguments given in the logfile, it actually provides
both of these arguments, also at load-time:

(second card - failing scenario):
Aug  9 22:58:32 ivar-laptop pulseaudio[2573]: module-udev-detect.c: Loading
module-alsa-card with arguments 'device_id="2"
name="usb-BeAutiful_Qing_Audioengine_AW1-00"
card_name="alsa_card.usb-BeAutiful_Qing_Audioengine_AW1-00" tsched=yes
ignore_dB=no card_properties="module-udev-detect.discovered=1"'


So my questions are:
Is there a way to load both these cards without modifying the source?
Can I configure something to make this work?
What is the reasoning behind setting this flag at all?
Which side-effect will I experience by simply ignoring this flag, and trying
to add a ".%u" to the card-name anyway?

Thanks for any help provided.


Kind Regards,
Ivar Mossin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100821/3f944243/attachment.htm>


More information about the pulseaudio-discuss mailing list