Smoren / huawei-ubuntu-sound-fix

Fix for sound card behavior on Huawei Matebook s14 / s16 on Ubuntu 22.04 / Fedora / Arch
140 stars 24 forks source link

A solution to "amixer : Host is down" caused by PipeWire being default sound card #11

Closed Purestone closed 6 months ago

Purestone commented 7 months ago

In some standard installation of linux distros, PipeWire is installed to handle computer sound. However, PipeWire sound card is identified as the default device for amixer, that blocks this sound fix from functioning well since amixer get Headphone | grep -q "off"command only do things on the default device. Under this circumstance, if you run huawei-soundcard-headphones-monitor.sh in terminal, info "amixer : Host is down" occurs.

To avoid this, you could get the ID of your actual sound device with alsamixer , and then press F6 button to open sound card menu to see the number. In my case below, 0 is the real sound device. Screenshot from 2024-01-31 22-45-35 And you shall edit the huawei-soundcard-headphones-monitor.sh. In line 48, replace amixer with, in my case, amixer -c 0 , the number should be the same as the ID we got before. Then install the sound fix and check if it works.

It works on my device MACHD-WXX9/MACHD-WFE9Q aka Matebook X Pro 2021. more kernel and hardware info:

Host: MatebookLinuX Kernel: 6.6.10-1-MANJARO arch: x86_64 bits: 64 Desktop: GNOME v: 45.3 Distro: Manjaro Linux Machine: Type: Laptop System: HUAWEI product: MACHD-WXX9 v: M1160 serial: Mobo: HUAWEI model: MACHD-WXX9-PCB-B1 v: M1160 serial: UEFI: HUAWEI v: 2.38 date: 05/29/2023

Also, since it is a default sound card problem, I think a more simple solution exits definitely. Please let me know if you have any ideas about it.

vpkopylov commented 7 months ago

I'm on ArchLinux, the fix stopped working for me recently because of this problem. Interesting that amixer get Headphone | grep -q "off" command works under a normal user, and fails only under root (maybe because pipewire itself runs as a user service ). @Purestone Why do you think that your solution isn't simple enough? soft-hda-dsp sound card should have index 0 in most cases, and we can get the index using grep from /proc/asound/cards to be more flexible.

Purestone commented 7 months ago

@vpkopylov Because in the beginning I thought this can be fixed by configuring amixer or PipeWire. Thanks to your help, now the steps are simplified a lot!

vpkopylov commented 7 months ago

@Purestone As you can see I created a PR using your solution. Even if it can be solved by changing configuration, setting the audio device explicitly it a good thing to do and it should work on all kinds of systems. @Smoren What do you think?