On Huawei MateBook 14s/16s, the Linux sound card driver has the headphone and speaker outputs swapped. When headphones are plugged in, audio plays through the speakers, and vice versa.
This is a hardware quirk: the internal speaker (widget 0x17) ignores DAC connection select commands and mirrors the headphone jack (widget 0x16). Switching outputs requires sending HDA verb commands directly to the sound card.
A systemd user service runs in the background and applies the correct HDA verb commands at startup and whenever WirePlumber resumes (e.g. after suspend). A WirePlumber Lua hook triggers the re-apply on audio node state changes.
- Debian/Ubuntu-based distro
- WirePlumber (PipeWire session manager)
Step 1 — Install dependencies and configure the system (requires sudo):
sudo apt-get install -y alsa-tools alsa-utils
sudo usermod -aG audio "$USER"
sudo setcap cap_sys_rawio+ep "$(which hda-verb)"alsa-toolsprovideshda-verb, used to send commands directly to the sound cardusermodadds your user to theaudiogroup for access to/dev/snd/devicessetcapgrantshda-verbraw I/O access so it can run without root
Re-login after this step for the audio group membership to take effect.
Step 2 — Install the service:
bash install.shbash uninstall.shsystemctl --user status huawei-sound-fix
systemctl --user restart huawei-sound-fix
systemctl --user stop huawei-sound-fix