Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huawei MateBook D16 microphone led does not work #53

Closed
m1khal3v opened this issue Sep 29, 2021 · 66 comments
Closed

Huawei MateBook D16 microphone led does not work #53

m1khal3v opened this issue Sep 29, 2021 · 66 comments

Comments

@m1khal3v
Copy link

m1khal3v commented Sep 29, 2021

Describe the bug
LED on the F7(fn+mic) key does not light up when microphone is turned off

Expected behavior
When the microphone is turned off, the LED on the F7(fn+mic) key should light up

Kernel: 5.14.8-051408-generic
Distro: Ubuntu 20.04.3 LTS
Loaded WMI modules:

snd_rawmidi            40960  1 snd_seq_midi
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
huawei_wmi             20480  0
ledtrig_audio          16384  2 snd_hda_codec_generic,huawei_wmi
sparse_keymap          16384  1 huawei_wmi
wmi_bmof               16384  0
snd                    94208  22 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm,snd_rawmidi
wmi                    32768  2 huawei_wmi,wmi_bmof

acpidump.txt | dmidecode.txt | dmesg.txt

@m1khal3v
Copy link
Author

Now I tried to install version 3.4 using dkms autoinstall, but it didn't change anything

@m1khal3v
Copy link
Author

Also I updated the BIOS to the latest version and it didn't help. I attach dumps after manipulations
acpidump.txt | dmidecode.txt | dmesg.txt

@canack
Copy link

canack commented Sep 29, 2021

I have the same problem on the same device.
Also the charge limit doesn't work either.

@m1khal3v
Copy link
Author

@EnginAcikgoz hello, look battery issue here #52

@aymanbagabas
Copy link
Owner

Does the led light up when you do

echo 1 | sudo tee /sys/devices/platform/huawei-wmi/leds/platform::micmute/brightness

@canack
Copy link

canack commented Sep 30, 2021

Does the led light up when you do

echo 1 | sudo tee /sys/devices/platform/huawei-wmi/leds/platform::micmute/brightness

yes, the code is working and led light up.

@aymanbagabas
Copy link
Owner

@EnginAcikgoz this means there is nothing wrong with huawei-wmi. What desktop environment are you using? When I use GNOME or KDE, this simply works fine because these DEs know how to talk to the micmute led interface. If you're not using a DE that recognizes XF86 keys, then you won't get the led to work when you press the key.

The way this works is, when you press the key, the driver fires an event with the code 0x287 which then gets translated to F20 in SystemD. This is because XF86AudioMicMute keycode is beyond what X.Org supports (or something between these lines). The DE keyboard event handler detects the event and mutes the microphone which then triggers the realtek sound hda to set the led using the huawei-wmi micmute led function based on Huawei's sound PCI vendor id 0x19e5 which you can verify when you run alsa-info.sh

@m1khal3v
Copy link
Author

m1khal3v commented Sep 30, 2021

@aymanbagabas Thanks for answer

echo 1 | sudo tee /sys/devices/platform/huawei-wmi/leds/platform::micmute/brightness

LED lights up

@EnginAcikgoz this means there is nothing wrong with huawei-wmi. What desktop environment are you using? When I use GNOME or KDE, this simply works fine because these DEs know how to talk to the micmute led interface. If you're not using a DE that recognizes XF86 keys, then you won't get the led to work when you press the key.

The way this works is, when you press the key, the driver fires an event with the code 0x287 which then gets translated to F20 in SystemD. This is because XF86AudioMicMute keycode is beyond what X.Org supports (or something between these lines). The DE keyboard event handler detects the event and mutes the microphone which then triggers the realtek sound hda to set the led using the huawei-wmi micmute led function based on Huawei's sound PCI vendor id 0x19e5 which you can verify when you run alsa-info.sh

I use Gnome 3.36.9 and xorg-server 2:1.20.11-1ubuntu1~20.04.2. Could you tell us how to find clues why this does not work on our hardware?

@aymanbagabas
Copy link
Owner

@m1khal3v could you upload the output of alsa-info.sh? Also what happens if you mute the mic from GNOME sound settings?

@m1khal3v
Copy link
Author

m1khal3v commented Sep 30, 2021

@aymanbagabas http://alsa-project.org/db/?f=bdffc32fb0826fbe78792752b0fade8b4c4a43f7
when I turn off the microphone from the gnome settings nothing happens

@aymanbagabas
Copy link
Owner

aymanbagabas commented Sep 30, 2021

k now I see the problem.

It seems like new Huawei devices have a different subsystem id compared to the old ones. Linux-Hardware.org shows devices with this subsystem vendor id HVY-WXX9, KLVC-WXX9, KLVL-WXX9, WRTB-WXX9, MACHC-WAX9, and WRTB-WXX9.

!!PCI Soundcards installed in the system
!!--------------------------------------

03:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:1637]
	Subsystem: Device [1e83:3e30]
03:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller [1022:15e3]
	Subsystem: Device [1e83:3e30]

Related: #39

@m1khal3v
Copy link
Author

m1khal3v commented Oct 1, 2021

@aymanbagabas try to hook fn+f7

sudo evtest /dev/input/event5                                                                                                                                                                   11:40:43 
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "Huawei WMI hotkeys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 171 (KEY_CONFIG)
    Event code 190 (KEY_F20)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 238 (KEY_WLAN)
    Event code 240 (KEY_UNKNOWN)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1633077645.416658, type 4 (EV_MSC), code 4 (MSC_SCAN), value 287
Event: time 1633077645.416658, type 1 (EV_KEY), code 190 (KEY_F20), value 1
Event: time 1633077645.416658, -------------- SYN_REPORT ------------
Event: time 1633077645.416682, type 1 (EV_KEY), code 190 (KEY_F20), value 0
Event: time 1633077645.416682, -------------- SYN_REPORT ------------

@aymanbagabas
Copy link
Owner

@m1khal3v could you please try this module and see if the led work

unzip snd-hda-codec-realtek.zip
sudo cp snd-hda-codec-realtek.ko /lib/modules/`uname -r`/updates
sudo depmod -a
sudo reboot

snd-hda-codec-realtek.zip

@canack
Copy link

canack commented Oct 11, 2021

@m1khal3v could you please try this module and see if the led work

unzip snd-hda-codec-realtek.zip
sudo cp snd-hda-codec-realtek.ko /lib/modules/`uname -r`/updates
sudo depmod -a
sudo reboot

snd-hda-codec-realtek.zip

I tried it in manjaro KDE environment and it didn't work.

5.13.19-2-MANJARO

@aymanbagabas
Copy link
Owner

@enginacikgoz did the module load lsmod | grep realtek? did it load the right module, locally compiled on my machine running Fedora 5.14 kernel, modinfo snd-hda-codec-realtek? are any of SELinux or AppArmor enabled and preventing the module to load, do you get any errors in dmesg? does the sound work in your system? what happens when you mute the mic from the sound settings?

@canack
Copy link

canack commented Oct 11, 2021

lsmod | grep realtek returns none.
i tried sudo insmod snd-hda-codec-realtek.ko and i got this insmod: ERROR: could not insert module snd-hda-codec-realtek.ko: Invalid module format

"dmesg | grep realtek" output:

[ 2.579709] snd_hda_codec_realtek: version magic '5.13.0-rc6+ SMP mod_unload ' should be '5.13.19-2-MANJARO SMP preempt mod_unload '

[ 2.579809] snd_hda_codec_realtek: version magic '5.13.0-rc6+ SMP mod_unload ' should be '5.13.19-2-MANJARO SMP preempt mod_unload '

[ 106.725274] snd_hda_codec_realtek: version magic '5.13.0-rc6+ SMP mod_unload ' should be '5.13.19-2-MANJARO SMP preempt mod_unload '

[ 134.422834] snd_hda_codec_realtek: version magic '5.13.0-rc6+ SMP mod_unload ' should be '5.13.19-2-MANJARO SMP preempt mod_unload '

I can turn the microphone off and on without any problems via ctrl + f7 or the system settings, but in both cases the microphone light does not turn on.

@canack
Copy link

canack commented Oct 11, 2021

modinfo.txt

@aymanbagabas
Copy link
Owner

seems like because of the kernel version differences it is not letting you load the module. could you try insmod -f snd-hda-codec-realtek.ko and/or modprobe -f and observe dmesg? if this doesn't work you might need to compile the module yourself

@aymanbagabas
Copy link
Owner

aymanbagabas commented Oct 11, 2021

also try after copying the new module to /lib/modules/`uname -r`/updates

sudo depmod -a
sudo modprobe -f snd-hda-codec-realtek

@aymanbagabas
Copy link
Owner

does modinfo snd-hda-codec-realtek returns kernel 5.14?

@canack
Copy link

canack commented Oct 11, 2021

does modinfo snd-hda-codec-realtek returns kernel 5.14?

No, returns 5.13
modinfo.txt

@aymanbagabas
Copy link
Owner

k, this is how you'd build the module yourself

  1. clone the linux kernel from https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git, checkout v5.13
  2. apply this patch using git am < [PATCH] 0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt
  3. follow this guide to build snd-hda-codec-realtek (you don't really want to build the whole kernel belive me) https://yoursunny.com/t/2018/one-kernel-module/. make sure you have your headers then you'd do make -C . M=sound/pci/hda, then copy sound/pci/hda/snd-hda-codec-realtek.ko to /lib/modules/`uname -r`/updates, depmod -a, reboot, and modprobe -f snd-hda-codec-realtek

if everything goes well, modinfo snd-hda-codec-realtek should give you an unsigned module and micmute hopefully works

@canack
Copy link

canack commented Oct 12, 2021

These are a bit complicated for me. I will try it as soon as possible though. Thank you. =)

@aymanbagabas
Copy link
Owner

aymanbagabas commented Oct 13, 2021

it really isn't tbh, i just need to verify it works before I can submit the patch to the mailing list. here, try this

git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
git checkout v5.13 # or whatever matches your kernel
wget https://github.com/aymanbagabas/Huawei-WMI/files/7326045/0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt
git am < 0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt
cp /boot/config-`uname -r` .config
cp /usr/src/linux-headers-`uname -r`/Module.symvers .
make oldconfig # accept all default values if any (press enter)
make scripts prepare modules_prepare
make -C . M=sound/pci/hda

if everything goes well, you should get a patched sound/pci/hda/snd-hda-codec-realtek.ko file that you can modprobe -f to test. dmesg -w is also handy to watch for logs and errors.

you could also copy the patched module to /lib/modules/`uname -r`/updates then do sudo depmod -a, so you can use sudo modprobe -f snd-hda-codec-realtek which should use the updated one from the updates directory. verify that with modinfo snd-hda-codec-realtek

@canack
Copy link

canack commented Oct 13, 2021

it really isn't tbh, i just need to verify it works before I can submit the patch to the mailing list. here, try this

git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
git checkout v5.13 # or whatever matches your kernel
wget https://github.com/aymanbagabas/Huawei-WMI/files/7326045/0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt
git am < 0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt
cp /boot/config-`uname -r` .config
cp /usr/src/linux-headers-`uname -r`/Module.symvers .
make oldconfig # accept all default values if any (press enter)
make scripts prepare modules_prepare
make -C . M=sound/pci/hda

if everything goes well, you should get a patched sound/pci/hda/snd-hda-codec-realtek.ko file that you can modprobe -f to test. dmesg -w is also handy to watch for logs and errors.

you could also copy the patched module to /lib/modules/`uname -r`/updates then do sudo depmod -a, so you can use sudo modprobe -f snd-hda-codec-realtek which should use the updated one from the updates directory. verify that with modinfo snd-hda-codec-realtek

Thank you, I'm trying right now. I will post the result

@canack
Copy link

canack commented Oct 13, 2021

Sir, zsh: no such file or directory: /boot/config-5.13.19-2-MANJARO what i should do?
ls /boot
amd-ucode.img grub initramfs-5.13-x86_64.img memtest86+ efi initramfs-5.13-x86_64-fallback.img linux513-x86_64.kver vmlinuz-5.13-x86_64

zsh: no such file or directory: /usr/src/linux-headers-5.13.19-2-MANJARO/Module.symvers

@aymanbagabas
Copy link
Owner

hmm, try zcat /proc/config.gz > .config taken from https://wiki.archlinux.org/title/Kernel/Traditional_compilation#Default_Arch_configuration

@canack
Copy link

canack commented Oct 13, 2021

Oh, my fault... i built for kernel 5.13... I will try again.

@canack
Copy link

canack commented Oct 13, 2021

I did build for 5.13.19 but still not working.. :(

@ufierro
Copy link

ufierro commented Oct 18, 2021

I apologize for hijacking this issue, but I haven't been able to get neither speakers nor microphone to work in the Matebook D16 pro, wondering if any of you could point me in the right direction? Again, sorry for hijacking the issue, just couldn't find anything on this problem

@m1khal3v
Copy link
Author

m1khal3v commented Nov 9, 2021

@aymanbagabas Today I noticed that the sound in the right earpiece has disappeared, how can I roll back the changes?

UPD: I remove the modified driver and ran sudo depmod -a but it didn't help. After that I tried other headphones and noticed that the balance slider moved all the way to the left. I returned to the center and everything worked as before. Not sure if it has something to do with the driver but suddenly

@aymanbagabas
Copy link
Owner

0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt

@m1khal3v @enginacikgoz I've changed the name of the entry in the patch, perhaps this makes a difference? Could you try this instead? Just make sure you undo the previous one in the linux tree git reset HEAD^ && git checkout sound

@canack
Copy link

canack commented Nov 9, 2021

0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt

@m1khal3v @enginacikgoz I've changed the name of the entry in the patch, perhaps this makes a difference? Could you try this instead? Just make sure you undo the previous one in the linux tree git reset HEAD^ && git checkout sound

Still not working. But i got extra information.

just to be sure i did the steps here from scratch and just changed the patch file

git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
git checkout v5.15 # or whatever matches your kernel
wget https://github.com/aymanbagabas/Huawei-WMI/files/7507422/0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt 
git am < 0001-ALSA-hda-realtek-New-Huawei-vendor-ID.patch.txt
zcat /proc/config.gz > .config
cp /usr/lib/modules/5.15.0-1-MANJARO/build/Module.symvers .
make oldconfig # accept all default values if any (press enter)
make scripts prepare modules_prepare
make -C . M=sound/pci/hda
cp sound/pci/hda/snd-hda-codec-realtek.ko /lib/modules/5.15.0-1-MANJARO/updates/
sudo depmod -a

Still not working but make -C . M=sound/pci/hda gives me this output

  CC [M]  sound/pci/hda/hda_bind.o
  CC [M]  sound/pci/hda/hda_codec.o
  CC [M]  sound/pci/hda/hda_jack.o
  CC [M]  sound/pci/hda/hda_auto_parser.o
  CC [M]  sound/pci/hda/hda_sysfs.o
  CC [M]  sound/pci/hda/hda_controller.o
  CC [M]  sound/pci/hda/hda_proc.o
  CC [M]  sound/pci/hda/hda_hwdep.o
  CC [M]  sound/pci/hda/hda_beep.o
  LD [M]  sound/pci/hda/snd-hda-codec.o
  CC [M]  sound/pci/hda/hda_generic.o
  LD [M]  sound/pci/hda/snd-hda-codec-generic.o
  CC [M]  sound/pci/hda/patch_realtek.o
  LD [M]  sound/pci/hda/snd-hda-codec-realtek.o
  CC [M]  sound/pci/hda/patch_cmedia.o
  LD [M]  sound/pci/hda/snd-hda-codec-cmedia.o
  CC [M]  sound/pci/hda/patch_analog.o
  LD [M]  sound/pci/hda/snd-hda-codec-analog.o
  CC [M]  sound/pci/hda/patch_sigmatel.o
  LD [M]  sound/pci/hda/snd-hda-codec-idt.o
  CC [M]  sound/pci/hda/patch_si3054.o
  LD [M]  sound/pci/hda/snd-hda-codec-si3054.o
  CC [M]  sound/pci/hda/patch_cirrus.o
  LD [M]  sound/pci/hda/snd-hda-codec-cirrus.o
  CC [M]  sound/pci/hda/patch_ca0110.o
  LD [M]  sound/pci/hda/snd-hda-codec-ca0110.o
  CC [M]  sound/pci/hda/patch_ca0132.o
  LD [M]  sound/pci/hda/snd-hda-codec-ca0132.o
  CC [M]  sound/pci/hda/patch_conexant.o
  LD [M]  sound/pci/hda/snd-hda-codec-conexant.o
  CC [M]  sound/pci/hda/patch_via.o
  LD [M]  sound/pci/hda/snd-hda-codec-via.o
  CC [M]  sound/pci/hda/patch_hdmi.o
  CC [M]  sound/pci/hda/hda_eld.o
  LD [M]  sound/pci/hda/snd-hda-codec-hdmi.o
  CC [M]  sound/pci/hda/hda_intel.o
  LD [M]  sound/pci/hda/snd-hda-intel.o
  MODPOST sound/pci/hda/Module.symvers
  CC [M]  sound/pci/hda/snd-hda-codec-analog.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-analog.ko
  BTF [M] sound/pci/hda/snd-hda-codec-analog.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-analog.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-ca0110.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-ca0110.ko
  BTF [M] sound/pci/hda/snd-hda-codec-ca0110.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-ca0110.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-ca0132.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-ca0132.ko
  BTF [M] sound/pci/hda/snd-hda-codec-ca0132.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-ca0132.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-cirrus.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-cirrus.ko
  BTF [M] sound/pci/hda/snd-hda-codec-cirrus.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-cirrus.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-cmedia.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-cmedia.ko
  BTF [M] sound/pci/hda/snd-hda-codec-cmedia.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-cmedia.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-conexant.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-conexant.ko
  BTF [M] sound/pci/hda/snd-hda-codec-conexant.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-conexant.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-generic.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-generic.ko
  BTF [M] sound/pci/hda/snd-hda-codec-generic.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-generic.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-hdmi.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-hdmi.ko
  BTF [M] sound/pci/hda/snd-hda-codec-hdmi.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-hdmi.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-idt.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-idt.ko
  BTF [M] sound/pci/hda/snd-hda-codec-idt.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-idt.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-realtek.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-realtek.ko
  BTF [M] sound/pci/hda/snd-hda-codec-realtek.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-realtek.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-si3054.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-si3054.ko
  BTF [M] sound/pci/hda/snd-hda-codec-si3054.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-si3054.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec-via.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec-via.ko
  BTF [M] sound/pci/hda/snd-hda-codec-via.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec-via.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-codec.mod.o
  LD [M]  sound/pci/hda/snd-hda-codec.ko
  BTF [M] sound/pci/hda/snd-hda-codec.ko
Skipping BTF generation for sound/pci/hda/snd-hda-codec.ko due to unavailability of vmlinux
  CC [M]  sound/pci/hda/snd-hda-intel.mod.o
  LD [M]  sound/pci/hda/snd-hda-intel.ko
  BTF [M] sound/pci/hda/snd-hda-intel.ko
Skipping BTF generation for sound/pci/hda/snd-hda-intel.ko due to unavailability of vmlinux

Before doing these operations, I deleted snd-hda-codec-realtek.ko and ran sudo depmod -a

filename:       /lib/modules/5.15.0-1-MANJARO/kernel/sound/pci/hda/snd-hda-codec-realtek.ko.xz
description:    Realtek HD-audio codec
license:        GPL
srcversion:     B4F4F18FD2A4CB93EBCF3E2
alias:          hdaudio:v10EC1220r*a01*
alias:          hdaudio:v10EC1168r*a01*
alias:          hdaudio:v10EC0B00r*a01*
alias:          hdaudio:v10EC0900r*a01*
alias:          hdaudio:v10EC0899r*a01*
alias:          hdaudio:v10EC0897r*a01*
alias:          hdaudio:v10EC0892r*a01*
alias:          hdaudio:v10EC0889r*a01*
alias:          hdaudio:v10EC0888r*a01*
alias:          hdaudio:v10EC0888r00100101a01*
alias:          hdaudio:v10EC0887r*a01*
alias:          hdaudio:v10EC0885r*a01*
alias:          hdaudio:v10EC0885r00100103a01*
alias:          hdaudio:v10EC0885r00100101a01*
alias:          hdaudio:v10EC0883r*a01*
alias:          hdaudio:v10EC0882r*a01*
alias:          hdaudio:v10EC0880r*a01*
alias:          hdaudio:v10EC0867r*a01*
alias:          hdaudio:v10EC0711r*a01*
alias:          hdaudio:v10EC0703r*a01*
alias:          hdaudio:v10EC0701r*a01*
alias:          hdaudio:v10EC0700r*a01*
alias:          hdaudio:v10EC0680r*a01*
alias:          hdaudio:v10EC0671r*a01*
alias:          hdaudio:v10EC0670r*a01*
alias:          hdaudio:v10EC0668r*a01*
alias:          hdaudio:v10EC0667r*a01*
alias:          hdaudio:v10EC0665r*a01*
alias:          hdaudio:v10EC0663r*a01*
alias:          hdaudio:v10EC0662r00100300a01*
alias:          hdaudio:v10EC0662r00100101a01*
alias:          hdaudio:v10EC0662r00100002a01*
alias:          hdaudio:v10EC0862r*a01*
alias:          hdaudio:v10EC0861r*a01*
alias:          hdaudio:v10EC0660r*a01*
alias:          hdaudio:v10EC0861r00100340a01*
alias:          hdaudio:v10EC0623r*a01*
alias:          hdaudio:v10EC0300r*a01*
alias:          hdaudio:v10EC0299r*a01*
alias:          hdaudio:v10EC0298r*a01*
alias:          hdaudio:v10EC0295r*a01*
alias:          hdaudio:v10EC0294r*a01*
alias:          hdaudio:v10EC0293r*a01*
alias:          hdaudio:v10EC0292r*a01*
alias:          hdaudio:v10EC0290r*a01*
alias:          hdaudio:v10EC0289r*a01*
alias:          hdaudio:v10EC0288r*a01*
alias:          hdaudio:v10EC0287r*a01*
alias:          hdaudio:v10EC0286r*a01*
alias:          hdaudio:v10EC0285r*a01*
alias:          hdaudio:v10EC0284r*a01*
alias:          hdaudio:v10EC0283r*a01*
alias:          hdaudio:v10EC0282r*a01*
alias:          hdaudio:v10EC0280r*a01*
alias:          hdaudio:v10EC0276r*a01*
alias:          hdaudio:v10EC0275r*a01*
alias:          hdaudio:v10EC0274r*a01*
alias:          hdaudio:v10EC0272r*a01*
alias:          hdaudio:v10EC0270r*a01*
alias:          hdaudio:v10EC0269r*a01*
alias:          hdaudio:v10EC0268r*a01*
alias:          hdaudio:v10EC0267r*a01*
alias:          hdaudio:v10EC0262r*a01*
alias:          hdaudio:v10EC0260r*a01*
alias:          hdaudio:v10EC0257r*a01*
alias:          hdaudio:v10EC0256r*a01*
alias:          hdaudio:v10EC0255r*a01*
alias:          hdaudio:v10EC0245r*a01*
alias:          hdaudio:v10EC0236r*a01*
alias:          hdaudio:v10EC0235r*a01*
alias:          hdaudio:v10EC0234r*a01*
alias:          hdaudio:v10EC0233r*a01*
alias:          hdaudio:v10EC0231r*a01*
alias:          hdaudio:v10EC0230r*a01*
alias:          hdaudio:v10EC0225r*a01*
alias:          hdaudio:v10EC0222r*a01*
alias:          hdaudio:v10EC0221r*a01*
alias:          hdaudio:v10EC0215r*a01*
depends:        snd-hda-codec,snd-hda-core,snd-hda-codec-generic,snd
retpoline:      Y
intree:         Y
name:           snd_hda_codec_realtek
vermagic:       5.15.0-1-MANJARO SMP preempt mod_unload 
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        7B:41:28:18:CB:36:CE:59:D6:81:DD:91:7E:67:AC:22:D2:23:F1:55
sig_hashalgo:   sha512
signature:      8F:97:52:13:92:B4:22:78:99:0F:CA:69:D9:8F:9A:30:95:71:7F:1D:
                A7:37:11:A6:AF:1C:33:5D:C3:32:A1:63:94:07:FC:25:E2:8E:9D:D5:
                4E:29:BA:BA:7C:8B:3A:90:E0:CC:AF:55:C0:47:3C:03:09:29:16:F0:
                26:7C:37:AB:44:6A:DB:11:69:F7:7B:3B:5B:50:D0:C3:DF:5D:E4:0C:
                84:81:31:6E:F2:9B:82:0C:EA:97:FE:34:1B:9C:CC:B6:D2:7F:BE:78:
                5C:9F:90:1E:AD:5A:07:36:D1:55:82:E2:B7:02:C2:21:4D:2E:E9:99:
                77:10:4E:32:1A:C5:4C:09:02:B3:41:17:3A:9B:78:06:CD:02:5F:3A:
                FF:22:5B:E6:0F:ED:95:DE:4E:CC:0B:60:8C:41:C6:33:35:5B:32:97:
                DA:BA:5E:10:21:4A:01:7C:48:77:EB:A4:4A:B3:20:C2:7A:F3:70:5D:
                29:DE:BE:E9:4C:54:67:F5:AC:BD:D7:4E:FD:E1:DF:43:27:A5:F4:03:
                8E:7B:4B:9E:BB:A8:CB:7A:BE:11:C4:B4:CD:E1:73:32:61:1C:36:43:
                8C:36:82:7B:8D:D8:04:71:90:76:F7:1A:65:CB:21:F3:91:58:5A:92:
                03:0B:73:7D:3A:53:8B:6C:22:21:88:DE:FD:C4:7A:F8:A8:23:6E:1F:
                24:80:90:C3:DF:57:97:03:19:E1:00:F9:AC:A2:FB:14:9F:D8:C8:08:
                B1:40:08:70:72:C8:97:53:4F:05:75:9F:86:3C:D8:80:35:E7:D5:2E:
                BC:90:2E:E0:AF:53:74:B5:BA:3F:66:7D:C6:D7:F0:74:11:DA:4E:F4:
                77:25:00:06:BF:9D:FE:96:60:14:A3:81:0A:34:49:49:71:BE:33:AC:
                F1:18:FB:A9:FE:DF:3B:69:6C:84:14:97:14:B3:AC:CC:F0:48:B6:F8:
                D1:2B:B9:71:96:57:32:C1:41:AB:62:EF:4E:F5:07:F6:67:4E:0A:0F:
                8D:8A:2E:3E:1F:7B:5C:CE:0B:10:85:50:39:5B:67:6E:EA:14:EE:25:
                C7:C0:94:A0:F6:11:69:1E:3A:5F:8A:8A:78:12:BF:EB:C4:E9:EC:39:
                5C:0D:4B:17:44:96:16:5F:39:5D:46:D1:41:E4:4C:F4:93:B6:14:15:
                69:A9:6F:93:0F:B0:B3:D3:13:7E:03:08:54:A0:73:B0:5A:50:5D:21:
                4C:78:E2:99:49:95:3A:89:7F:6F:F0:D2:57:25:27:5E:6C:E8:F3:4B:
                D9:F8:CE:62:A0:74:03:8D:6B:F2:8F:A2:21:C3:71:37:37:E2:3E:A8:
                63:1F:77:A0:9F:43:8D:50:56:80:50:E9                                                      

This is the result after processing

filename:       /lib/modules/5.15.0-1-MANJARO/updates/snd-hda-codec-realtek.ko
description:    Realtek HD-audio codec
license:        GPL
srcversion:     5818162B3B3528C02324285
alias:          hdaudio:v10EC1220r*a01*
alias:          hdaudio:v10EC1168r*a01*
alias:          hdaudio:v10EC0B00r*a01*
alias:          hdaudio:v10EC0900r*a01*
alias:          hdaudio:v10EC0899r*a01*
alias:          hdaudio:v10EC0897r*a01*
alias:          hdaudio:v10EC0892r*a01*
alias:          hdaudio:v10EC0889r*a01*
alias:          hdaudio:v10EC0888r*a01*
alias:          hdaudio:v10EC0888r00100101a01*
alias:          hdaudio:v10EC0887r*a01*
alias:          hdaudio:v10EC0885r*a01*
alias:          hdaudio:v10EC0885r00100103a01*
alias:          hdaudio:v10EC0885r00100101a01*
alias:          hdaudio:v10EC0883r*a01*
alias:          hdaudio:v10EC0882r*a01*
alias:          hdaudio:v10EC0880r*a01*
alias:          hdaudio:v10EC0867r*a01*
alias:          hdaudio:v10EC0711r*a01*
alias:          hdaudio:v10EC0703r*a01*
alias:          hdaudio:v10EC0701r*a01*
alias:          hdaudio:v10EC0700r*a01*
alias:          hdaudio:v10EC0680r*a01*
alias:          hdaudio:v10EC0671r*a01*
alias:          hdaudio:v10EC0670r*a01*
alias:          hdaudio:v10EC0668r*a01*
alias:          hdaudio:v10EC0667r*a01*
alias:          hdaudio:v10EC0665r*a01*
alias:          hdaudio:v10EC0663r*a01*
alias:          hdaudio:v10EC0662r00100300a01*
alias:          hdaudio:v10EC0662r00100101a01*
alias:          hdaudio:v10EC0662r00100002a01*
alias:          hdaudio:v10EC0862r*a01*
alias:          hdaudio:v10EC0861r*a01*
alias:          hdaudio:v10EC0660r*a01*
alias:          hdaudio:v10EC0861r00100340a01*
alias:          hdaudio:v10EC0623r*a01*
alias:          hdaudio:v10EC0300r*a01*
alias:          hdaudio:v10EC0299r*a01*
alias:          hdaudio:v10EC0298r*a01*
alias:          hdaudio:v10EC0295r*a01*
alias:          hdaudio:v10EC0294r*a01*
alias:          hdaudio:v10EC0293r*a01*
alias:          hdaudio:v10EC0292r*a01*
alias:          hdaudio:v10EC0290r*a01*
alias:          hdaudio:v10EC0289r*a01*
alias:          hdaudio:v10EC0288r*a01*
alias:          hdaudio:v10EC0287r*a01*
alias:          hdaudio:v10EC0286r*a01*
alias:          hdaudio:v10EC0285r*a01*
alias:          hdaudio:v10EC0284r*a01*
alias:          hdaudio:v10EC0283r*a01*
alias:          hdaudio:v10EC0282r*a01*
alias:          hdaudio:v10EC0280r*a01*
alias:          hdaudio:v10EC0276r*a01*
alias:          hdaudio:v10EC0275r*a01*
alias:          hdaudio:v10EC0274r*a01*
alias:          hdaudio:v10EC0272r*a01*
alias:          hdaudio:v10EC0270r*a01*
alias:          hdaudio:v10EC0269r*a01*
alias:          hdaudio:v10EC0268r*a01*
alias:          hdaudio:v10EC0267r*a01*
alias:          hdaudio:v10EC0262r*a01*
alias:          hdaudio:v10EC0260r*a01*
alias:          hdaudio:v10EC0257r*a01*
alias:          hdaudio:v10EC0256r*a01*
alias:          hdaudio:v10EC0255r*a01*
alias:          hdaudio:v10EC0245r*a01*
alias:          hdaudio:v10EC0236r*a01*
alias:          hdaudio:v10EC0235r*a01*
alias:          hdaudio:v10EC0234r*a01*
alias:          hdaudio:v10EC0233r*a01*
alias:          hdaudio:v10EC0231r*a01*
alias:          hdaudio:v10EC0230r*a01*
alias:          hdaudio:v10EC0225r*a01*
alias:          hdaudio:v10EC0222r*a01*
alias:          hdaudio:v10EC0221r*a01*
alias:          hdaudio:v10EC0215r*a01*
depends:        snd-hda-codec,snd-hda-core,snd-hda-codec-generic,snd
retpoline:      Y
name:           snd_hda_codec_realtek
vermagic:       5.15.0-MANJARO+ SMP preempt mod_unload 

I hope this information was helpful. Thanks for be interested.

@aymanbagabas
Copy link
Owner

What's the output of cat /sys/bus/hdaudio/devices/hdaudio*/*?

@aymanbagabas
Copy link
Owner

@enginacikgoz could you also provide your sudo alsa-info.sh output?

@canack
Copy link

canack commented Nov 9, 2021

cat /sys/bus/hdaudio/devices/hdaudio*/*

0x1
R6xx HDMI
cat: /sys/bus/hdaudio/devices/hdaudioC0D0/driver: Is a directory
0x0
hdaudio:v1002AA01r00100700a01
cat: /sys/bus/hdaudio/devices/hdaudioC0D0/power: Is a directory
0x100700
cat: /sys/bus/hdaudio/devices/hdaudioC0D0/subsystem: Is a directory
0xaa0100
0x1
DRIVER=snd_hda_codec_hdmi
MODALIAS=hdaudio:v1002AA01r00100700a01

0x1002aa01
ATI
cat: /sys/bus/hdaudio/devices/hdaudioC0D0/widgets: Is a directory
0x1
Generic
cat: /sys/bus/hdaudio/devices/hdaudioC1D0/driver: Is a directory
0x0
hdaudio:v10EC0256r00100002a01
cat: /sys/bus/hdaudio/devices/hdaudioC1D0/power: Is a directory
0x100002
cat: /sys/bus/hdaudio/devices/hdaudioC1D0/subsystem: Is a directory
0x1e833243
0x1
DRIVER=snd_hda_codec_generic
MODALIAS=hdaudio:v10EC0256r00100002a01

0x10ec0256
Realtek
cat: /sys/bus/hdaudio/devices/hdaudioC1D0/widgets: Is a directory

And here is sudo alsa-info.sh
alsa-info

@aymanbagabas
Copy link
Owner

k, i guess it's clear what the issue now haha. the card uses the snd_hda_codec_generic driver and not the realtek one hehe. so we're basically patching the wrong driver lol

@canack
Copy link

canack commented Nov 9, 2021

k, i guess it's clear what the issue now haha. the card uses the snd_hda_codec_generic driver and not the realtek one hehe. so we're basically patching the wrong driver lol

Sorry for bothering you so much. =')

@canack
Copy link

canack commented Nov 10, 2021

Additional info:
When I run the xdotool key XF86AudioMicMute command, the microphone can be turned on and off, but the led does not work

@canack
Copy link

canack commented Nov 10, 2021

Additional info:
When i change /sys/devices/platform/huawei-wmi/leds/platform::micmute/trigger parameter like "kbd-capslock,BAT0-charging-or-full,audio-mute,hci0-power" nothing was happend. Led does not syncing with this triggers. But echo 1 > brightness works flawlessly

@aymanbagabas
Copy link
Owner

k, i guess it's clear what the issue now haha. the card uses the snd_hda_codec_generic driver and not the realtek one hehe. so we're basically patching the wrong driver lol

Okay, I take that back, 10EC0256 is a realtek driver so snd_hda_codec_realtek should be loaded when you boot the system. /sys/bus/hdaudio/devices/hdaudioC1D0 shows that the loaded driver is in fact snd_hda_codec_generic which is realy confusing.

@sermart1234
Copy link
Collaborator

sermart1234 commented Nov 27, 2021

On my Honor Magicbook Pro 2020 i have popup notification, but led don't turn on.
echo 1 > brightness works. I think the problem is with triggers.

huawei->cdev.default_trigger = "audio-micmute"; but [none] usb-gadget usb-host rfkill-any rfkill-none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock ACAD-online BAT1-charging-or-full BAT1-charging BAT1-full BAT1-charging-blink-full-solid disk-activity disk-read disk-write ide-disk mtd nand-disk cpu cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 panic rc-feedback audio-mute audio-micmute bluetooth-power hci0-power rfkill0 phy0rx phy0tx phy0assoc phy0radio rfkill1

I try echo 'audio-micmute' > trigger but it doesn't work. Also dont work kbd-capslock or cpu trigger

@sermart1234
Copy link
Collaborator

sermart1234 commented Nov 27, 2021

sermart@sermart-HLYL-WXX9:~/$ xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ELAN2204:00 04F3:30F5 Mouse               id=10   [slave  pointer  (2)]
⎜   ↳ ELAN2204:00 04F3:30F5 Touchpad            id=11   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ ov9734_azurewave_camera: ov9734           id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=13   [slave  keyboard (3)]
    ↳ Huawei WMI hotkeys                        id=12   [slave  keyboard (3)]
sermart@sermart-HLYL-WXX9:~/$ xinput test 12
key press   198 
key release 198 
key press   198 
key release 198

198 is micmute key
but in 60-keyboard.hwdb

# Huawei WMI hotkeys driver
evdev:name:Huawei WMI hotkeys:dmi:bvn*:bvr*:bd*:svnHUAWEI:*
 KEYBOARD_KEY_287=f20                                   # Microphone mute button, should be micmute

what does it mean?

@canack
Copy link

canack commented Nov 28, 2021

i have got same outputs with sermart1234.
key press 198
key release 198
echo 1 > brightness works but triggers doesn't work.

@sermart1234
Copy link
Collaborator

On Huawei Matebook D15 AMD micmute led works

[nixos@nixos:~]$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ ELAN2204:00 04F3:30F5 Mouse             	id=12	[slave  pointer  (2)]
⎜   ↳ ELAN2204:00 04F3:30F5 Touchpad          	id=13	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ ov9734_azurewave_camera: ov9734         	id=11	[slave  keyboard (3)]
    ↳ Huawei WMI hotkeys                      	id=14	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=15	[slave  keyboard (3)]

[nixos@nixos:~]$ xinput test 14
key press   198 
key release 198 
key press   198 
key release 198 

cat trigger print
none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock ACAD-online BAT1-charging-or-full BAT1-charging BAT1-full BAT1-charging-blink-full-solid rfkill-any rfkill-none audio-mute [audio-micmute] rfkill0 phy0rx phy0tx phy0assoc phy0radio rfkill1

@sermart1234
Copy link
Collaborator

@aymanbagabas how i can fix audio-micmute trigger?

@aymanbagabas
Copy link
Owner

@aymanbagabas how i can fix audio-micmute trigger?

when you press the micmute key, do you get Unknown key pressed, code: 0x... in dmesg?

the wmi interface fires a key event when you press a function key. then this gets processed using huawei_wmi_process_key which maps keycodes to linux sparse keymap defined in https://github.com/aymanbagabas/Huawei-WMI/blob/master/huawei-wmi.c#L75

the micmute key works by mapping 0x287 which is usually what you get from the interface, not 198, to KEY_MICMUTE which then Systemd 60-keyboard.hwdb keyboard mapping maps to F20 because of some issue with the micmute keycode being not compatible with window systems. then the desktop environment should handle this key event to mute the mic which then triggers the led trigger audio-micmute and turn the led on.

@sermart1234
Copy link
Collaborator

@aymanbagabas

[   39.044958] atkbd serio0: Unknown key released (translated set 2, code 0xf8 on isa0060/serio0).
[   39.044972] atkbd serio0: Use 'setkeycodes e078 <keycode>' to make it known.
[   39.160598] atkbd serio0: Unknown key released (translated set 2, code 0xf8 on isa0060/serio0).
[   39.160606] atkbd serio0: Use 'setkeycodes e078 <keycode>' to make it known.
[   44.739427] atkbd serio0: Unknown key released (translated set 2, code 0xf8 on isa0060/serio0).
[   44.739442] atkbd serio0: Use 'setkeycodes e078 <keycode>' to make it known.

@sermart1234
Copy link
Collaborator

@aymanbagabas huawei_wmi_process_key work. I delete { KE_KEY, 0x287, { KEY_MICMUTE } } and micmute notification is not displayed. But...

//{ KE_KEY,    0x287,          { KEY_MICMUTE } },
{ KE_KEY,    0x287,          { KEY_CONFIG } },

don't work.
it spams in dmesg whenever I press the Huawei hotkeys

[   44.739427] atkbd serio0: Unknown key released (translated set 2, code 0xf8 on isa0060/serio0).
[   44.739442] atkbd serio0: Use 'setkeycodes e078 <keycode>' to make it known.

@aymanbagabas
Copy link
Owner

@sermart1234 good observation. Huawei-WMI driver creates a new keyboard for the hotkeys which are defined in that table, 0x287 is the micmute keycode extracted from the WMI method. atkbd is the original driver for the keyboard which doesn't handle Huawei hotkeys and instead emit 0xf8 for almost all hotkeys.

@sermart1234
Copy link
Collaborator

@aymanbagabas how do triggers for LEDs work? how can emulate a trigger? Does it depend on the audio driver? should I configure systemd, udev? Or will you just have to write a script for processing the micmute button?

@aymanbagabas
Copy link
Owner

@sermart1234 AFAICT each trigger is implemented differently in the LED subsystem. if echo 1 > brightness works, then the triggers should work too unless something wrong with the trigger. as you can see in the source code here, we only set the default trigger which can be changed from the LED sysfs interface

@sermart1234
Copy link
Collaborator

@aymanbagabas Should the Realtek driver send events to turn off the LED? or DE?

@sermart1234
Copy link
Collaborator

Copy 99-Huawei.hwdb to /etc/udev/hwdb.d/ then update the hwdb tables
dmesg:
[ 210.011813] SELinux: Context u:object_r:system_data_file:s0 is not valid (left unmapped).

@aymanbagabas
Copy link
Owner

Can someone try this patch with the above instructions? Thank you!

0001-PATCH-ALSA-hda-realtek-New-Huawei-vendor-ID.txt

@canack
Copy link

canack commented Mar 11, 2022

Can someone try this patch with the above instructions? Thank you!

0001-PATCH-ALSA-hda-realtek-New-Huawei-vendor-ID.txt

unfortunately it is not working :( I guess matebook D16 doesn't use realtek driver.
If you wish, I can give you information by running additional commands on the computer I use.

Someone shared details about D16
link

@m1khal3v
Copy link
Author

Hello everybody. Any news here? May i help with something?

@aymanbagabas
Copy link
Owner

Closing this one as it is related to the AMD sound driver. https://bugzilla.kernel.org/show_bug.cgi?id=215119#c1

@ochi12
Copy link

ochi12 commented Apr 10, 2024

Huawei D15 2020 internal microphone array not detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants