PINE64
Headphone jack & audio switching - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114)
+--- Thread: Headphone jack & audio switching (/showthread.php?tid=10477)



Headphone jack & audio switching - ThatGeoGuy - 06-28-2020

I'm running the unofficial debian build (link here) on my Pinebook Pro. Mine is a bit different though since I've switched to sid rather than Debian testing.

I've been having some troubles with getting audio to switch over to _exclusively_ play through headphones when they are plugged in. For whatever reason they seem to play back through the speakers AND headphones.

This kind of defeats the purpose of putting headphones in, and I'm at a bit of an impasse. I've tried using alsamixer, but no matter what I change there is no entry for the audio jack at all, and it seems as though there is some config that is broken.

Any tips for resetting the audio config on my install? I am hoping to avoid reinstalling the system at all costs since it's a bit of a hassle.


RE: Headphone jack & audio switching - bcnaz - 06-28-2020

The fix may soon be a simple 'update' away, if not now, likely soon.
I believe auto-detect is working on some of the Debian releases/distro's


RE: Headphone jack & audio switching - ThatGeoGuy - 06-28-2020

(06-28-2020, 11:19 AM)bcnaz Wrote: The fix may soon be a simple 'update' away,  if not now,  likely soon.
    I believe auto-detect is working on some of the Debian releases/distro's
Is there a thread, bug report, or some other indication of when that may happen and what work is required?


RE: Headphone jack & audio switching - bcnaz - 06-28-2020

Not a 'bug report' per se,

>  rather,  I recently saw a post on a Mobian thread,  a comment that the earphone socket now 'just works'

So I figure all or most other distros will soon have it also.


RE: Headphone jack & audio switching - ab1jx - 03-22-2021

In the old days there was a mechanical extra set of contacts in the headphone jack to disconnect the speakers when you plug headphones in.  That could be retrofitted in here, need to replace the jack and do some wiring.

This is close, not sure if it has the switches.  The ones with 3 connections don't, the ones wth 5 connections do.  Your junkbox may have some https://www.radioshack.com/products/1-8-stereo-panel-mount-phone-jack  I haven't looked at the mounting in the PBP, there are half a dozen different types.

Here's a pack of 10 of them for $5.40.  I like these because you can see the contacts.  https://www.aliexpress.com/item/912568250.html?spm=a2g0o.productlist.0.0.2729adfaFESwk6&algo_pvid=dea7178b-11fc-4991-b20c-291bc43c5ee5&algo_expid=dea7178b-11fc-4991-b20c-291bc43c5ee5-20&btsid=0bb0622e16164550508628843ee679&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_  You can watch the speaker connections open when you plug headphones in.

10 for $1.50 https://www.aliexpress.com/item/32775967220.html?spm=a2g0o.productlist.0.0.2729adfaFESwk6&algo_pvid=dea7178b-11fc-4991-b20c-291bc43c5ee5&algo_expid=dea7178b-11fc-4991-b20c-291bc43c5ee5-36&btsid=0bb0622e16164550508628843ee679&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_  But the shipping price is high.  I'm not sure if that's tariff or not, I ordered a pack of LEDs the other day with free shipping.  Something like 10 LEDs shipped to the US for $1.50.

[Image: HTB14yAhXNrvK1RjSszeq6yObFXaq.jpg]

I  was surprised that that didn't happen, also that nothing in alsamixer could help.


RE: Headphone jack & audio switching - moonwalkers - 03-23-2021

I can't seem to find it right now, but I've seen in Manjaro a package that vends a systemd service, an acpid event definition, and two scripts - one toggles headphones and built-in speakers on/off, and another that sets them correctly on boot. And it works correctly on my machine, so the issue seems to be less of an audio jack hardware and more of a some weird non-standard solution on how the event is interpreted in hardware/software, requiring extra hacks like said Manjaro package.


RE: Headphone jack & audio switching - ab1jx - 03-23-2021

This looks related.  https://github.com/GalliumOS/galliumos-distro/issues/318


RE: Headphone jack & audio switching - ab1jx - 03-23-2021

Eureka!  The answer is closer than we think: It's in the mrfixit stretch.  When I went to Daniel Thompson's Bullseye I didn't notice the problem right away so I didn't think about the software change.  But I still have stretch on my emmc so  I just pulled out my SD  and booted from it.  Started playing something, plugged in headphones and the speakers stopped working.

The mrfixit stretch is on github I think, maybe there's a changelog that lists it or maybe somebody can ask him. https://github.com/mrfixit2001/debian_desktop/releases His kernel stuff is at https://github.com/mrfixit2001/mainline-kernel

Actually on his Github page it says Boston, that's a 3 hour drive from here. Never met him.

It's probably something in "Endless number of tweaks for smooth desktop performance" which I don't see details of. Possibly it's in acpi. There was a lot very right in the mrfixit version like faster text scrolliing and this which I miss about the Thompson Bullseye. Which of course is a deboostrap script and it might be possible to have local customizations get applied. If I type dmesg in an rxvt window it scrolls for about a minute, there's no GPU involved I think.

There's not a lot of acpi stuff on there, I don't see the jack.sh that the Gallium link talks about above or an /etc/acpi directory. And they're mostly fixated on pulseaudo which I work at getting rid of.

Arch blames it on Pulseaudio, I'd have to boot into Stretch again to see if there's any pulseaudio https://bbs.archlinux.org/viewtopic.php?id=228087


RE: Headphone jack & audio switching - ab1jx - 03-23-2021

This turns it off but it stays off when you unplug the headphones:
Code:
amixer -c0 cset numid=28 0

numid=28,iface=MIXER,name='Speaker Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
So you could script turning it on and off but at least you get privacy.

For manual control a couple quick scripts.  Headphones stay on until you unplug them. 
Create them with your favorite editor someplace in your path, sudo may be required:
Code:
cat spon
#!/bin/bash
# Turn laptop speakers (always card 0) on
amixer -q -c0 cset numid=28 on &> /dev/null

cat spoff
!/bin/bash
# Turn laptop speakers (always card 0) off
amixer -q -c0 cset numid=28 0 &> /dev/null

chmod +x sp*

Alsamixer reads the state of the speaker switch but can't change it.  amixer is in alsa-utils.

Until somebody moves it here's a linked image to a block diagram.  Datasheets are easy to find by searching.
[Image: INrljx6.gif]