raphael / linux-samus

Linux 4.16 on Chromebook Pixel 2015
GNU General Public License v2.0
181 stars 36 forks source link

Headphones are gone with kernel 4.8.1 #164

Open victrcodes opened 7 years ago

victrcodes commented 7 years ago

I've upgraded straight from kernel 4.4 to 4.8, followed the section "Users upgrading from pre-4.7 Samus kernel". Everything is working, but headphones are gone from the sound settings. If I reboot back to kernel 4.8 without doing any changes - headphones are back, but now the mic is gone, probably due to the "Users upgrading from pre-4.7 Samus kernel" changes. Am I missing something here? I'm on Ubuntu 16.04.

nelsonni commented 7 years ago

Ditto. I'm having the same problem with no headphones listed after removing the following lines from /etc/pulse/default.pa:

#load-module module-alsa-sink device=hw:0,0
#load-module module-alsa-source device=hw:0,1
#load-module module-alsa-source device=hw:0,2

I know that the bdw-rt5677 driver is included in the latest kernel, but the headphone jack does not seem to be dynamically located and loaded without modifying /etc/pulse/default.pa.

rroll1 commented 7 years ago

Was this ever fixed? I'm on the latest samus kernel and I don't have headphones, which is kind of problematic (since I use headphones on my laptop far more than my speakers).

raphael commented 7 years ago

The scripts in the README work fine for me, I can use them to switch between headphones and speakers.

nsparks86 commented 7 years ago

Has anyone made a script to toggle this with a single action?

victrcodes commented 7 years ago

@nsparks86 there's nothing to toggle if headphones are not even loaded with latest kernel. I tend to agree with what @nelsonni said.

rroll1 commented 7 years ago

The script to toggle is in the readme, or at least, the commands. Here are the scripts I use to switch between headphones and speakers, based on @raphael's comment a week ago:

 $ cat /usr/sbin/samus-alsaenable-speakers 
 #!/bin/sh
 #

 ## enable audio
 amixer -c 0 cset name='DAC1 MIXL DAC1 Switch' on
 amixer -c 0 cset name='DAC1 MIXR DAC1 Switch' on

 ## enable speakers
 amixer -c 0 cset name='Headphone Switch' off
 amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' off
 amixer -c 0 cset name='Stereo DAC MIXR DAC1 R Switch' off
 amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' on
 amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on
 amixer -c 0 cset name='Speaker Switch' on
 $ cat /usr/sbin/samus-alsaenable-headphones 
 #!/bin/sh
 # 
 ## enable audio
 amixer -c 0 cset name='DAC1 MIXL DAC1 Switch' on
 amixer -c 0 cset name='DAC1 MIXR DAC1 Switch' on

 ## enable speakers
 amixer -c 0 cset name='Speaker Switch' off
 amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' off
 amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' off
 amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' on
 amixer -c 0 cset name='Stereo DAC MIXR DAC1 R Switch' on
 amixer -c 0 cset name='OUT1 Playback Switch' on
 amixer -c 0 cset name='OUT2 Playback Switch' on
 amixer -c 0 cset name='Headphone Switch' on

This works for me on

$ uname -a
Linux echo.pixel 4.8.6-6-ph #1 SMP Wed Nov 2 14:32:11 CDT 2016 x86_64 GNU/Linux

Haven't updated to 4.8.7 yet.

There are 2 issues currently, though neither of them are the headphones not working:

  1. Headphones don't show up in the Gnome Sound control panel, it only registers the speakers in that list. I believe that in earlier Samus kernels it showed up as an output device in the Sound control panel; now you have to use the amixer commands to switch.
  2. ACPI doesn't detect headphone plugs or unplugs, so it's impossible at the current moment to bind the scripts to ACPI events. Hopefully this will be fixed sometime in the future (maybe .7? Haven't installed it yet)
nsparks86 commented 7 years ago

I'm not very familiar with Bash scripting, but I figured I'd try and start somewhere. Could use a "Headphone/Speaker toggle" script, so I came up with these lines to determine the current state.

awk -F"[][]" '/Playback/ { print $2 }' <(amixer sget Speaker) awk -F"[][]" '/Playback/ { print $2 }' <(amixer sget Headphone)

stefanwiegmann commented 7 years ago

maybe stupid question: I am on KDE on Arch, still on my first install from April '15. Is everybody here using plain ALSA? Who has pulseaudio? I feel like my audio setup became a mess, especially looking into my mixer. Was also thinking of a fresh install, as I still wanted to update my ssd firmware eventually.

Anybody with KDE/Pulseaudio + the script and everything just works? And how many mixer items do you have? :-)

stefanwiegmann commented 7 years ago

I guess I was kind of hijacking this thread, but I did my fresh install. Only thing I had to do was running the sound scripts @raphael provided and everything worked as you would expect. My mess was due to still tinkering in my first install from over a year ago and with so many changes happening.....

As for the headphone/speaker switch: I would love acpi to work as well, but in the meantime I just put a toggle script on CTRL+[Volume Mute]. The script checks the current setup and switches with @raphael 's sound scripts accordingly.

raphael commented 7 years ago

Do you know if ACPI works with the vanilla 4.9 kernel?

stefanwiegmann commented 7 years ago

short answer: no.

for ls -l /usr/lib/modules/$(uname -r)/kernel/drivers/acpi

I get on your kernel 4.8.13-12-ph: total 184 -rw-r--r-- 1 root root 10408 Dec 9 16:15 ac.ko -rw-r--r-- 1 root root 12648 Dec 9 16:15 acpi_extlog.ko -rw-r--r-- 1 root root 14008 Dec 9 16:15 acpi_ipmi.ko -rw-r--r-- 1 root root 19072 Dec 9 16:15 acpi_pad.ko drwxr-xr-x 2 root root 4096 Dec 9 16:15 apei -rw-r--r-- 1 root root 21600 Dec 9 16:15 battery.ko -rw-r--r-- 1 root root 6384 Dec 9 16:15 custom_method.ko -rw-r--r-- 1 root root 7856 Dec 9 16:15 ec_sys.ko -rw-r--r-- 1 root root 13088 Dec 9 16:15 fan.ko drwxr-xr-x 2 root root 4096 Dec 9 16:15 nfit -rw-r--r-- 1 root root 11936 Dec 9 16:15 sbshc.ko -rw-r--r-- 1 root root 16704 Dec 9 16:15 sbs.ko -rw-r--r-- 1 root root 24224 Dec 9 16:15 thermal.ko

on stock 4.8.13-1:

total 108 -rw-r--r-- 1 root root 2946 Dec 9 01:25 ac.ko.gz -rw-r--r-- 1 root root 2787 Dec 9 01:25 acpi_configfs.ko.gz -rw-r--r-- 1 root root 4133 Dec 9 01:25 acpi_extlog.ko.gz -rw-r--r-- 1 root root 4334 Dec 9 01:25 acpi_ipmi.ko.gz -rw-r--r-- 1 root root 5513 Dec 9 01:25 acpi_pad.ko.gz drwxr-xr-x 2 root root 4096 Dec 9 01:25 apei -rw-r--r-- 1 root root 6748 Dec 9 01:25 battery.ko.gz -rw-r--r-- 1 root root 4930 Dec 9 01:25 button.ko.gz -rw-r--r-- 1 root root 1777 Dec 9 01:25 custom_method.ko.gz drwxr-xr-x 2 root root 4096 Dec 9 01:25 dptf -rw-r--r-- 1 root root 2297 Dec 9 01:25 ec_sys.ko.gz -rw-r--r-- 1 root root 3923 Dec 9 01:25 fan.ko.gz drwxr-xr-x 2 root root 4096 Dec 9 01:25 nfit -rw-r--r-- 1 root root 3537 Dec 9 01:25 sbshc.ko.gz -rw-r--r-- 1 root root 5529 Dec 9 01:25 sbs.ko.gz -rw-r--r-- 1 root root 7375 Dec 9 01:25 thermal.ko.gz -rw-r--r-- 1 root root 14251 Dec 9 01:25 video.ko.gz

I am not an acpi guy. would have to read up on it. I thought I read somewhere here acpi doesn't work in general for us. Is there a module we are missing or what did @rroll1 mean?

I'll check 4.9 as soon as I get it

stefanwiegmann commented 7 years ago

by the way, your current aur script doesn't build ;-)

raphael commented 7 years ago

Fixed it, thanks.