The headphone and speaker channels are mixed up in the sound card driver for Linux distributions.
When headphones are connected, the system considers that sound should be output from the speakers. When the headphones are off, the system tries to output sound through them.
Problem details (found here)
Looks like there is some weird hardware design, because from my prospective, the interesting widgets are:
- 0x01 - Audio Function Group
- 0x10 - Headphones DAC (really both devices connected here)
- 0x11 - Speaker DAC
- 0x16 - Headphones Jack
- 0x17 - Internal Speaker
And:
- widgets 0x16 and 0x17 simply should be connected to different DACs 0x10 and 0x11, but Internal Speaker 0x17 ignores the connection select command and use the value from Headphones Jack 0x16.
- Headphone Jack 0x16 is controlled with some weird stuff so it should be enabled with GPIO commands for Audio Group 0x01.
- Internal Speaker 0x17 is coupled with Headphone Jack 0x16 so it should be explicitly disabled with EAPD/BTL Enable command.
A daemon has been implemented that monitors the connection/disconnection of headphones and accesses the sound card device in order to switch playback to the right place.
bash install.sh
systemctl status huawei-soundcard-headphones-monitor
systemctl restart huawei-soundcard-headphones-monitor
systemctl start huawei-soundcard-headphones-monitor
systemctl stop huawei-soundcard-headphones-monitor
This fix definitely works under Ubuntu 22.04 and Fedora 39 for laptop model Huawei MateBook 14s.
$ inxi -F
System:
Host: smorenbook Kernel: 5.15.0-78-generic x86_64 bits: 64
Desktop: GNOME 42.9 Distro: Ubuntu 22.04.3 LTS (Jammy Jellyfish)
Machine:
Type: Laptop System: HUAWEI product: HKF-WXX v: M1010
serial: <superuser required>
Mobo: HUAWEI model: HKF-WXX-PCB v: M1010 serial: <superuser required>
UEFI: HUAWEI v: 1.06 date: 07/22/2022
If you want to thank me for this solution, you can subscribe to my Github profile and also give stars to my open source projects, e.g.:
- MolecuLarva — Virtual chemistry simultaion. Visualization of the behavior of particles in 2-dimensional and 3-dimensional space for artifical life research.
- IterTools TS — Extended itertools port for TypeScript and JavaScript. Provides a huge set of functions for working with iterable collections (including async ones).
- Schemator PHP — Schematic data mapper for converting nested data structures (any composition of associative arrays, non-associative arrays and objects) according to the given conversion schema.
- ArrayView PHP — tools to create array views for easy data manipulation, select elements using Python-like slice notation, enable efficient selection of elements using index lists and boolean masks.