[LAU] laptop confused: no sound with headphones in

Len Ovens len at ovenwerks.net
Tue Dec 10 18:20:56 CET 2019


On Mon, 9 Dec 2019, Atte wrote:

> I tried writing a script that un-mutes everything I can see and turns it 
> up, but to no avail:
>
> amixer set 'Master' 100% unmute
> amixer sset -c 0 'Master' 100% unmute
> amixer sset -c 0 'Headphone' 100% unmute
> amixer set -c 0 'Speaker' 100% unmute
> amixer set -c 0 'PCM' 100%
>
If only it was so simple. In days of old when apple computers didn't have 
a mouse or often any disc drive, Headphone jacks had extra contacts for 
switching speakers off. Not any more. HDA audio has this pin enabling that 
allows a mic jack to be mono with 5v power or a stereo output which is 
auto detectable or switchable by some applet. (In debian it is probably 
hdajackretask) However, I am sure you are looking for a more automated 
method. For this there is a tool called hda-verb (say what?). which can 
"enable/disable the headphone jack using pins."

An example that works on someone's laptop (doesn't work on my desktop for 
sure cause my pin numbers are different):

To enable headphone jack, use:

hda-verb /dev/snd/hwC0D0 0x0f SET_PIN_WIDGET_CONTROL 0x40

To disable headphone jack, use:

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

I am sure that both the file in /dev/snd/ and the value right after that 
(0x0f) need to match your system. On my system another (PCI) card picks up 
hw:0 and so mine would be hwC1D*

In my file on this stuff I don't seem to have added the file one would use 
to look up what these values might be. (not proc/asound it appears) But I 
did find it by googling so the stuff is out there.

BTW the acpi system probably detects headphone plug events. Use 
acpi_listen to see if this is true on your system. If so you can add a 
script to /etc/acpi/events/ (actually a pointer to a script I think) that 
will run on a headphone plug event. Some systems leave the headphone jack 
always enabled and only need levels changed, but yours seems to need pin 
changes too.

If you are using pulseaudio along with jack, I have found it best to 
remove both alsa and udev modules from pulse and direct everything through 
a pulse-jack bridge. Pulse will give up the audio device to jack just 
fine, but will remember the device is there and control levels, mutes and 
maybe pins even though jack has the device. Removing the alsa module will 
stop this and removing the udev module will stop it from reloading the 
alsa module on an alsa reset.

I haven't figured it out yet either. I hope you at least get started in 
the right direction.


--
Len Ovens
www.ovenwerks.net


More information about the Linux-audio-user mailing list