Ubuntu doesn’t allow headphone-only audio output?

Question

The audio works well and my laptop speakers as well as the headphones get the output from the system. However, when I go to Sound Settings and try to set “Analog Output” as the Connector, there is only one option, “Analog Speakers”, which obviously outputs the audio to the speakers and even to 2 extra sets of headphones simultaneously.

Nevertheless, I cannot have the computer output audio to the headphones only, as would be ideal to not bother everyone else in the room. This option was available in previous versions of Ubuntu. I am running 11.10, and I know it’s not the desktop environment; I’ve tested the configuration in Unity, Gnome Shell and Cinnamon, and quickly realized this has nothing to do with the shell, but rather (probably) the Pulse server.

I also have Debian 6 (squeeze) on my laptop and the option is present there and works just fine. Here’s a snapshot of the Sound Settings window on Ubuntu 11.10 and the only “Connector” alternative that you can see I have:

A snapshot of the Sound Settings available

I’ve already tested all the combinations of settings in all 5 tabs (Sound Effects, Hardware, Input, Output and Applications). There aren’t that many settings so it didn’t take long. I’ve seen this feature work on my computer with elder versions of Ubuntu and, as the hardware hasn’t changed at all, I don’t see how a new version of Ubuntu wouldn’t recognize my hardware properly.

Asked by the.midget

Answer

The answer involves executing commands from the terminal every time I need to switch from speaker to headphone (and the commands must be run as root) and vice versa, but it does the trick.

HP Laptops in the series dv-5, dv-6, dv-7 and some HP minis have a strange problem in Fedora 10. When you plug in headphones, the sound still continues to come out the speakers as well as out the headphone jack. And In Fedora 11, no sound actually comes out of the plugged in headphones. In this article we will tell you how to fix the problem in two different ways.

The Long Method

Download and unzip a package called hda-verb. Now use the following command line switches with hda-verb to turn on and off your headphone.

To activate the sound on the speaker:

sudo ./hda-verb /dev/snd/hwC0D0 0×1 set_gpio_data 1
sudo ./hda-verb /dev/snd/hwC0D0 0×1 set_gpio_dir 1
sudo ./hda-verb /dev/snd/hwC0D0 0×1 set_gpio_mask 1

To activate the sound on the headset:

sudo ./hda-verb /dev/snd/hwC0D0 0x0f SET_CONNECT_SEL 1

To mute the speaker:

sudo ./hda-verb /dev/snd/hwC0D0 0x0d SET_PIN_WIDGET_CONTROL 0

To unmute the speaker:

sudo ./hda-verb /dev/snd/hwC0D0 0x0d SET_PIN_WIDGET_CONTROL 0×40

To mute the headphones:

sudo ./hda-verb /dev/snd/hwC0D0 0x0f SET_PIN_WIDGET_CONTROL 0

To unmute the headphones:

sudo ./hda-verb /dev/snd/hwC0D0 0x0f SET_PIN_WIDGET_CONTROL 0×40

The Short Method

The method described above is very long indeed and becomes quite weird when you have to use it again and again. So you can use this package called hda-hp developed by a guy called vwbusguy. You can download the packages from here. The commands can be run as root as shown below:

headphone-on   – Mutes the laptop speakers, and unmutes the headphone jacks.
headphone-off   – Mutes the headphone jacks, and unmutes the laptop speakers.

Answered by the.midget