When _hotplugging_ a Bose (Companion 5) USB audio device, pulseaudio fails to configure it. It (seems to) work fine at the Alsa layer, and doing a cold plug (i.e., plug the USB before booting, or just stopping the pulseaudio server, plugging the device, restarting the server) works. This is with Linux 3.5 and pulseaudio 2.1 (Ubuntu 12.10 beta) but it also happened with pulseaudio 1.3 and 2.0. And this problem was already noted 3 years ago: http://www.redhat.com/archives/rhl-beta-list/2009-October/msg00715.html Note that the Bose device has a bit peculiar sound profile, as it only supports 4.1, 5.0, 5.1 channels (no 2 channels). Here is a short error log of the server when it fails. E: [pulseaudio] module-alsa-card.c: Failed to find a working profile. E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="1" name="usb-Bose_Corporation_Bose_USB_Audio-00-Audio" card_name="alsa_card.usb-Bose_Corporation_Bose_USB_Audio-00-Audio" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes card_properties="module-udev-detect.discovered=1""): initialization failed. : : [4 more times] : W: [pulseaudio] module-udev-detect.c: Tried to configure /devices/pci0000:00/0000:00:1d.2/usb7/7-2/7-2:1.0/sound/card1 (alsa_card.usb-Bose_Corporation_Bose_USB_Audio-00-Audio) more often than 5 times in 10s Please let me know if you are interested in more logs, or if there is anything I could try to investigate this problem further.
Just a few more details: * once properly configured on the pulseaudio server, unplugging and replugging works fine as long as the server keeps running. * sometimes (but not always), when it fails to configure, the kernel spits this message: 4:1:1: usb_set_interface failed (-71)
Could you attach two pulseaudio logs: one where you start pulseaudio with the sound card plugged in (the working case), and one where you start pulseaudio with the sound card unplugged and then plug it in? Instructions for getting the verbose log: https://wiki.ubuntu.com/PulseAudio/Log
Created attachment 66102 [details] Log of pulseaudio server when doing hotplug (failure)
Created attachment 66103 [details] Log of pulseaudio server when doing coldplug (succes)
Created attachment 66104 [details] [review] Log diff between hotplug and coldplug Here are the logs and the diff of them when attaching the Bose companion 5 with hotplug and coldplug
With coldplugging pulseaudio successfully opens the "surround41:1" device, but with coldplugging there's this: D: [pulseaudio] alsa-mixer.c: Looking at profile output:analog-surround-41 D: [pulseaudio] alsa-mixer.c: Checking for playback on Analog Surround 4.1 (analog-surround-41) D: [pulseaudio] alsa-util.c: Trying surround41:1 with SND_PCM_NO_AUTO_FORMAT ... I: [pulseaudio] (alsa-lib)confmisc.c: Unable to find definition 'cards.USB-Audio.pcm.surround51.0:CARD=1' I: [pulseaudio] (alsa-lib)conf.c: function snd_func_refer returned error: No such file or directory I: [pulseaudio] (alsa-lib)conf.c: Evaluate error: No such file or directory I: [pulseaudio] (alsa-lib)pcm.c: Unknown PCM surround41:1 I: [pulseaudio] alsa-util.c: Error opening PCM device surround41:1: No such file or directory It's not only about "surround41", none of the device names except "hw" is found. This looks like alsa bug. The configuration doesn't seem to be ready at the time when the card becomes available. I'm pretty clueless how this can be possible - I have always imagined that the alsa configuration is static. I don't understand why "cards.USB-Audio.pcm.surround51.0:CARD=1" would not exist when "hw:1" is available.
(In reply to comment #6) > With coldplugging pulseaudio successfully opens the "surround41:1" device, but > with coldplugging there's this: The second "coldplugging" was of course supposed to be "hotplugging".
Indeed, it seems strange that surround41 is not found while hw:1 is. I tried to check with "aplay -L" just after plugging the device in, and they seem to all appear simultaneously. Is there a way to force pulseaudio to try the initialization again a little bit after (e.g., with pacmd)? # aplay -L null Discard all samples (playback) or generate zero samples (capture) pulse PulseAudio Sound Server default:CARD=Intel HDA Intel, AD198x Analog Default Audio Device sysdefault:CARD=Intel HDA Intel, AD198x Analog Default Audio Device front:CARD=Intel,DEV=0 HDA Intel, AD198x Analog Front speakers surround40:CARD=Intel,DEV=0 HDA Intel, AD198x Analog 4.0 Surround output to Front and Rear speakers surround41:CARD=Intel,DEV=0 HDA Intel, AD198x Analog 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=Intel,DEV=0 HDA Intel, AD198x Analog 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=Intel,DEV=0 HDA Intel, AD198x Analog 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=Intel,DEV=0 HDA Intel, AD198x Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers dmix:CARD=Intel,DEV=0 HDA Intel, AD198x Analog Direct sample mixing device dsnoop:CARD=Intel,DEV=0 HDA Intel, AD198x Analog Direct sample snooping device hw:CARD=Intel,DEV=0 HDA Intel, AD198x Analog Direct hardware device without any conversions plughw:CARD=Intel,DEV=0 HDA Intel, AD198x Analog Hardware device with all software conversions default:CARD=Audio Bose USB Audio, USB Audio Default Audio Device sysdefault:CARD=Audio Bose USB Audio, USB Audio Default Audio Device front:CARD=Audio,DEV=0 Bose USB Audio, USB Audio Front speakers surround40:CARD=Audio,DEV=0 Bose USB Audio, USB Audio 4.0 Surround output to Front and Rear speakers surround41:CARD=Audio,DEV=0 Bose USB Audio, USB Audio 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=Audio,DEV=0 Bose USB Audio, USB Audio 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=Audio,DEV=0 Bose USB Audio, USB Audio 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=Audio,DEV=0 Bose USB Audio, USB Audio 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers iec958:CARD=Audio,DEV=0 Bose USB Audio, USB Audio IEC958 (S/PDIF) Digital Audio Output dmix:CARD=Audio,DEV=0 Bose USB Audio, USB Audio Direct sample mixing device dsnoop:CARD=Audio,DEV=0 Bose USB Audio, USB Audio Direct sample snooping device hw:CARD=Audio,DEV=0 Bose USB Audio, USB Audio Direct hardware device without any conversions plughw:CARD=Audio,DEV=0 Bose USB Audio, USB Audio Hardware device with all software conversions
After reading the log message once again, I just realized it contained the answer to my previous question ;-) So, after a hotplug failure, and making sure that everything is settled down in ALSA, I used pacmd to load the module again: >>> load-module module-alsa-card device_id="1" name="usb-Bose_Corporation_Bose_USB_Audio-00-Audio" card_name="alsa_card.usb-Bose_Corporation_Bose_USB_Audio-00-Audio" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes card_properties="module-udev-detect.discovered=1" Module load failed. It fails exactly the same way as during hotplug.
It's odd that it fails when loading module-alsa-card manually. The only explanation that I can think of is that the card gets somehow permanently mis-initialized if pulseaudio tries to use it too soon. Some things to test that theory: once you have done a failed hotplug attempt, and left the card plugged in, does it also fail if you unload module-udev-detect and load it again? If that fails, does it fail if you restart pulseaudio (without unplugging the card at any point)? What about "speaker-test --channels=5 --device=surround41:1", does it work after a failed hotplug attempt?
Took me quite a long time to test. I feel there are actually two bugs. In addition to this pulseaudio bug, it seems that in some _rare_ cases the kernel fails to initialize the card correctly. When this happens, dmesg is full of such lines: [28853.024822] 2:1:1: usb_set_interface failed (-71) Then ALSA lists the device correctly but is unable to play anything on it (on any profile). Again, that's happening pretty rarely (~ once every 20 plug-in's). For the rest of this bug report, I'll just ignore this "kernel bug", assuming they are not related. Back to the pulseaudio bug, I tested to do a hotplug leading to an initialization failure and then trying to use the card: * "speaker-test --channels=5 --device=surround41:1" works fine * unloading/reloading module module-udev-detect doesn't help (same error) * unloading the other module-alsa-card (for the internal card) fixes the problem! The conclusion is that the card does not seem mis-initialized, but more a problem with multi-load of module-alsa-card. After a failure hotplug I can do this: pacmd unload-module 4 # that's the module-alsa-card for the Intel card load-module module-alsa-card device_id="1" name="usb-Bose_Corporation_Bose_USB_Audio-00-Audio" card_name="alsa_card.usb-Bose_Corporation_Bose_USB_Audio-00-Audio" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes => the Bose card is ready Alternatively, after unloading module-alsa-card it's possible to unload/load module-udev-detect, and you get both cards working (like a coldplug). Does this hint on where could be laying the bug?
My guess is that when libasound reads the configuration too early, the configuration is somehow not ready yet, and the unfinished configuration is then cached by libasound so that as long as libasound is being linked to the pulseaudio process, the configuration never gets updated. Once you unload all modules that use libasound (i.e. all module-alsa-card instances), then libasound gets unlinked too from the pulseaudio process. Subsequent loading of module-alsa-card works, because now libasound properly reloads the configuration which is ready at this point. So, I blame alsa for everything... That's based on guessing only, though, so I'll keep this bug open here at PulseAudio side too, in case someone wants to dig deeper. You can report the problem on the alsa-devel mailing list.
Created attachment 123387 [details] Patch that fixes the bug It was indeed a bug in alsa-lib.
ALSA patch got rejected, they want this feature to be opt-in via new API. http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107816.html
you have post output of alsa-info.sh and lsusb -vvvv if your usb audio does not support stereo, it is a bug of combine sink include any slave whech does not support stereo
https://bugs.freedesktop.org/show_bug.cgi?id=88265#c5 as your boss companion 5 does not support stereo but only 6 channels your ad1981 does not support 6 channels combine sink may need to drop slave
This is now fixed in the "next" branch, meaning that PulseAudio 10.0 will have the fix: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=efb14524a210e84fff573753f697b3c9baaa67a3
(In reply to Tanu Kaskinen from comment #17) > This is now fixed in the "next" branch, meaning that PulseAudio 10.0 will > have the fix: > https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/ > ?id=efb14524a210e84fff573753f697b3c9baaa67a3 The link is broken, here's a working link: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=768c80f3c35da28f10a293ffa62c0e092db65db5
*** Bug 98401 has been marked as a duplicate of this bug. ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.