Skip to content

Instantly share code, notes, and snippets.

@philipperoubert
Last active November 26, 2023 01:06
Show Gist options
  • Save philipperoubert/a4dd97bd94c78a588147c044000a87da to your computer and use it in GitHub Desktop.
Save philipperoubert/a4dd97bd94c78a588147c044000a87da to your computer and use it in GitHub Desktop.
Huawei Matebook 14S Audio Fix
value=`cat selected_audio_output.txt`
if [ -z "$value" ]
then
value=0
fi
if [ $value -eq 0 ]
then
sudo hda-verb /dev/snd/hwC0D0 0x16 0x701 0x0001 // move output to speaker dac
sudo hda-verb /dev/snd/hwC0D0 0x17 0x70C 0x0002 // enable speaker
sudo hda-verb /dev/snd/hwC0D0 0x1 0x715 0x2 // disable headphones
value=1
else
sudo hda-verb /dev/snd/hwC0D0 0x16 0x701 0x0000 // move output to headphones dac
sudo hda-verb /dev/snd/hwC0D0 0x17 0x70C 0x0000 // disable speaker
sudo hda-verb /dev/snd/hwC0D0 0x1 0x717 0x2 // pin output mode
sudo hda-verb /dev/snd/hwC0D0 0x1 0x716 0x2 // pin enable
sudo hda-verb /dev/snd/hwC0D0 0x1 0x715 0x0 // clear pin value
value=0
fi
echo $value > selected_audio_output.txt
@ogunbaysal
Copy link

Hey, thanks for this solution.
I am using Debian 11 KDE 5.20.5 on Matebook 14s. I have a problem. I did exactly what you share. When i turn on headphone mode it works but after a little time, sound comes from both speaker and headphone even if headphone mode is turned on. After I change mode to Speaker and again Headphone, it works again. Do you have any idea why this happens?

@philipperoubert
Copy link
Author

Hey, thanks for this solution. I am using Debian 11 KDE 5.20.5 on Matebook 14s. I have a problem. I did exactly what you share. When i turn on headphone mode it works but after a little time, sound comes from both speaker and headphone even if headphone mode is turned on. After I change mode to Speaker and again Headphone, it works again. Do you have any idea why this happens?

Sorry for the belated response. Sorry to hear that this doesn't work on your PC.

I fear the issue may be coming from the distros, KDE Plasma vs Ubuntu, or maybe a difference in Kernel version. What kernel is your distro using? In my case I was using 5.19. Hope this can help.

@Smoren
Copy link

Smoren commented Aug 7, 2023

Thank for this code! I've created a daemon for listening headphones connected/disconnected and switching audio output: https://github.com/Smoren/huawei-ubuntu-sound-fix

@eniskastrati
Copy link

Hey everyone,
I just got a matebook 14 with AMD Ryzen 7 and 16gb RAM and on linux distros (already tested Mint, Ubuntu 23 and 22) is not working.
Only with bluetoth headset is working, beside that no speeker is working even if I plug in headphones in the jack they are not recognized and don't work and no sound at all.
Even the microphone input is also not even detected.
Any clue what the issue there might be and how I can fix it, cause I just don't want to change to windows after beeing for more than 4 year a linux user.
In windows works everything perfectly!
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment