3

I have an Acer TravelMate P648-MG laptop. I had troubles getting sound to work until I found pavucontrol. There, in the Configuration tab, I can set the configuration to Analog Stereo Duplex. Then I have a single output device called "Built-in Audio Analog Stereo" with three ports: Speakers (that is the laptop's internal speakers), Line out and "Headphones (unplugged)" (yes, the "unplugged" part is there). When I set the port to "Headphones (unplugged)" then the sound goes where it should - to the plugged speakers/headphones.

However, every time I restart (or just restart pulseaudio with pulseaudio -k) this setting is lost. I usually end up with Speakers set as the port for the output device. How can I store this setting permanently?

It's Ubuntu Gnome 16.10. Feel free to ask for additional data (logs, hardware configuration, etc.).

1 Answer 1

5

Pulseaudio can not automatically connect to a headset that may or may not be present on startup. It will always try to connect to the next available device, which usually would be "internal analog".

To ovecome this we may load a pulseaudio module that allows autoconnecting to an additional sound device as soon as it was connected with:

pactl load-module module-switch-on-connect

If it does what is expected we can load it everytime pulseaudio starts by adding the following line to our /etc/pulse/default.pa (or ~/.config/pulse/default.pa if we had defined it locally):

load-module module-switch-on-connect

After an edit of default.pa pulseaudio needs to be restarted with pulseaudio -k for changes to take effect.


Above module only works on plugging in the headphones. In case it was always plugged in we may add the following line to the end of the default.pa:

set-sink-port <name|index>  analog-output-headphones

The name or index of the active sink, and available ports can be displayed with pactl list sinks.

5
  • Did not help. Even without restart, when I restart pulseaudio the output is switched back to Speakers. Maybe I did not state it correctly - it does not switch to a different device but rather to a different port within the "Built-in Audio Analog Stereo" device. I'm editing the question right now.
    – zegkljan
    Dec 12, 2016 at 7:54
  • Try with module module-switch-on-port-available then. Both modules require that you manually plug in your headset for switching to it. If it was always plugged in this won't work.
    – Takkat
    Dec 12, 2016 at 7:58
  • module-switch-on-port-available is already part of /etc/pulse/default.pa (right after module-{device,stream,card}-restore and module-augment-properties) and no automatic switching occurs.
    – zegkljan
    Dec 12, 2016 at 8:06
  • See edit for changing the default port
    – Takkat
    Dec 12, 2016 at 8:13
  • That did it! Thanks. However, this means that pa is stuck to the headphones port. That is not a big deal for me as I have speakers/headphones plugged in most of the time. Seems my laptop/ubuntu/pulseaudio has troubles detecting the plugged headphones (pactl list sinks says "unavailable" at the headphone port even though they are plugged in). Thanks nevertheless, issue solved. The failure to detect is a different one.
    – zegkljan
    Dec 12, 2016 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .