Bug 74609

Summary: Speakers are unmuted on pulseaudio start, even if headphones are plugged in
Product: PulseAudio Reporter: AnAkkk <anakin.cs>
Component: modulesAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: anakin.cs, anarsoul, lennart
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 71677, 75721    
Attachments: pulseaudio log

Description AnAkkk 2014-02-06 11:36:52 UTC
Created attachment 93521 [details]
pulseaudio log

Let's say I boot my system with my headphones plugged out, then the sound normally comes out of speaker. If I plug headphone in, speaker get muted, which is normal and what I want.

Now, let's say I boot my system with my headphones plugged in, then the sound comes out of headphones, and speaker are muted.
The problem is that pulseaudio automatically unmutes speaker when it starts (the volume stays at 0 though), and it shouldn't, considering headphones are still plugged in. This leads to a second problem:
1) I plug out my headphones, they are muted, the speaker is still unmuted, but the speaker volume stays at 0.
2) then, if I plug in headphones again, the speaker is muted and its volume is still 0, as expected.
3) I plug out my headphones, they are muted, the speaker is unmuted and its volume is set to 100.

This means that when I boot my system with headphones plugged in, if I want sound from my speakers, I need to plug out/plug in/plug out headphones before it works.


I can't find a solution for the problem I am having, I am not sure if there is a pulseaudio setting that control this.
I have attached a pulseaudio log just after starting it (headphones were plugged in)
Comment 1 AnAkkk 2014-02-06 12:13:01 UTC
I've talked with tanuk on IRC:

[13:06] <tanuk> AnAkkk: My guess is that when starting PA with headphones plugged in, the port is "analog-output", when unplugging headphones, the port stays at "analog-output", when plugging headphones, it changes to "analog-output-headphones", and when unplugging again, it changes to "analog-output-speakers".
[13:07] <tanuk> AnAkkk: If that's a correct guess, then I can reproduce the bug on my machine, and might be motivated enough to fix it some time soon.

That's indeed what happens.
Comment 2 Raymond 2014-02-06 22:22:52 UTC
D: [pulseaudio] module-alsa-card.c: Found 7 jacks.
I: [pulseaudio] alsa-util.c: Successfully attached to mixer 'hw:0'
D: [pulseaudio] module-alsa-card.c: Jack 'Headphone Jack' is now plugged in
D: [pulseaudio] device-port.c: Setting port analog-output-speaker to status no
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio] module-switch-on-port-available.c: finding port analog-output-speaker
D: [pulseaudio] module-alsa-card.c: Jack 'Speaker Phantom Jack' is now plugged in
D: [pulseaudio] module-alsa-card.c: Jack 'Headphone Jack' is now plugged in
D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status yes
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio] module-switch-on-port-available.c: finding port analog-output-headphones
D: [pulseaudio] module-alsa-card.c: Jack 'HDMI/DP,pcm=3 Jack' is now unplugged
Comment 3 Tanu Kaskinen 2014-03-03 16:28:09 UTC
I want this fixed in 6.0, so I made this now a release blocker bug.
Comment 4 Raymond 2014-03-04 07:48:12 UTC
D: [pulseaudio] alsa-mixer.c: Probe of element 'Headphone' succeeded (volume=2, switch=2, enumeration=0).

post output of alsa-info.sh 

if the laptop has two headphone jacks, 

do pulseaudio use the states of both jack to determine whether the speaker shdould be mute or not ?
Comment 5 Tanu Kaskinen 2014-04-25 10:50:04 UTC
*** Bug 77390 has been marked as a duplicate of this bug. ***
Comment 6 Fabian Homborg 2014-07-03 23:01:49 UTC
I've been bitten by this bug and found a workaround. Putting

     load-module module-switch-on-port-available

as the last line in default.pa, not "after module-*-restore, but before module-*-detect" as the comment claims.

(This is on archlinux, with pulse 5.0)
Comment 7 Tanu Kaskinen 2014-08-17 11:53:20 UTC
I sent a couple of patches to the mailing list that should fix this: http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/20915
Comment 8 Arun Raghavan 2014-10-11 15:14:26 UTC
Tanu, does the first patch in your set fix this? If yes, we should go ahead and close this. Else, would be good to know what's left (second patch in the series?).
Comment 9 Tanu Kaskinen 2014-10-17 11:08:12 UTC
The first patch isn't sufficient. What's left: change the second patch so that it doesn't remove "Element Master Mono", and I also promised to write a test that verifies that the analog-output path is indeed a subset of all mixer paths that should kill it.
Comment 10 Tanu Kaskinen 2014-10-27 11:24:10 UTC
I submitted an updated patch to the list: http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/21800

I still haven't written the test.
Comment 11 Tanu Kaskinen 2014-10-31 12:42:34 UTC
I merged the patch, so this bug should now be fixed.

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.