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

Add keyboard backlight timeout as an option #38

Open
german-rios-gonzalez opened this issue Aug 12, 2020 · 84 comments
Open

Add keyboard backlight timeout as an option #38

german-rios-gonzalez opened this issue Aug 12, 2020 · 84 comments

Comments

@german-rios-gonzalez
Copy link

Hi, first of all thank you very much for this project, the effort and the great results, I came here because by default the keyboard backlight timeout it's about 15 seconds on my Matebook D14 2020, and currently I can't find a way to set the backlight always on, I don't have any knowledge about the kernel internals but I guess you can add this option on this project, this would be wonderful for people that work in dark conditions.

@nekr0z
Copy link

nekr0z commented Aug 12, 2020

Do you know for a fact that changing keyboard backlight timeout is at all possible on yout MateBook?

I don’t really know about D14, but at least for the MateBook 13 I own I know no way to tweak that on any operating system. I was actually under impression it wasn’t possible on any MateBooks.

(Originally published at: https://evgenykuznetsov.org/en/reactions/2020/matebook-keyb-backlight/)

@german-rios-gonzalez
Copy link
Author

german-rios-gonzalez commented Aug 12, 2020

Hi, @nekr0z I have the model NBL-WAQ9R Matebook D14 2020, the software that comes preinstalled with this laptop have the option to never turn off, I wiped out this operative system but this article show what I'm talking about.

https://consumer.huawei.com/en/support/content/en-us00723328/#:~:text=Open%20PC%20Manager%2C%20click%20the,to%20turn%20on%20the%20backlight.

@nekr0z
Copy link

nekr0z commented Aug 13, 2020

Wow! I had no idea! @aymanbagabas, this is definitely worth looking into.

@aymanbagabas
Copy link
Owner

Interesting! Could you please provide an ACPI dump?
https://01.org/linux-acpi/utilities

@german-rios-gonzalez
Copy link
Author

Hi, @aymanbagabas thanks for the link, I followed the instructions and I attached the zipped result file. (For the record I use Fedora as operative system)
acpidump.zip

@aymanbagabas
Copy link
Owner

aymanbagabas commented Aug 14, 2020

This looks promising, these 2 methods 'looks' like the ones to get/set the keyboard backlight (assuming KBBL stands for KeyBoard BackLight). They appear in the HWMI interface in SSDT5 under 0x0602 and 0x0702.

    Method (GLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100){})
        Name (CONT, Zero)
        Local0 = Arg0
        CreateByteField (BUFF, Zero, STAT)
        CreateByteField (BUFF, One, SURV)
        CreateByteField (BUFF, 0x02, KBBL)
        CONT = Zero
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        \_SB.PCI0.LPC0.EC0.ECM3 (0xC4)
        While (((CONT != 0x0A) && ((\_SB.PCI0.LPC0.EC0.ECXC & One) == Zero)))
        {
            CONT += One
            Sleep (0x32)
        }

        KBBL = \_SB.PCI0.LPC0.EC0.ECXD
        Release (\_SB.PCI0.LPC0.EC0.ECMT)
        STAT = Zero
        Return (BUFF) /* \GLIV.BUFF */
    }

    Method (SLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100){})
        Local0 = Arg0
        CreateByteField (Arg0, 0x02, KBBV)
        CreateByteField (BUFF, Zero, STAT)
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        If ((((KBBV == 0x04) || (KBBV == 0x08)) || (KBBV == 0x10)))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (KBBV)
            STAT = Zero
        }
        Else
        {
            STAT = One
        }

        Release (\_SB.PCI0.LPC0.EC0.ECMT)
        Return (BUFF) /* \SLIV.BUFF */
    }

Could you try these commands out and report the output

  • echo 0x000602 | sudo tee /sys/kernel/debug/huawei-wmi/arg
  • sudo cat /sys/kernel/debug/huawei-wmi/call
    Cycle through the keyboard backlight levels and run the same commands.

@german-rios-gonzalez
Copy link
Author

german-rios-gonzalez commented Aug 14, 2020

Hi, @aymanbagabas I get these results for the 3 states of the keyboard backlight

Keyboard backlight turn off:

echo 0x000602 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x000602

[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

Keyboard backlight level 1:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x000602 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x000602

[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

Keyboard backlight level 2:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x000602 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x000602

[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

@aymanbagabas
Copy link
Owner

Hahaa, bingo! I gotta try this in my machine. You can see the changes here in the first and last cases (the second seems odd). Looking at the methods, the available values are 0x04, 0x08, and 0x10.

Could you try these with each value and observe the changes to the keyboard backlight

  • echo 0x[VALUE]0702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
  • sudo cat /sys/kernel/debug/huawei-wmi/call

@german-rios-gonzalez
Copy link
Author

Hi, I can't see any difference maybe I do it wrong?

Keyboard backlight level 2 and 0x04:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x040702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x040702

[root@Huawei-NBL-WAQ9R ~]# sudo cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

Keyboard backlight level 2 and 0x08:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x080702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x080702

[root@Huawei-NBL-WAQ9R ~]# sudo cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

Keyboard backlight level 2 and 0x10:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x100702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x100702

[root@Huawei-NBL-WAQ9R ~]# sudo cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

@aymanbagabas
Copy link
Owner

Ok, there is a catch, you gotta run each set of commands twice to get a result, otherwise, you'll get 0x01.

@german-rios-gonzalez
Copy link
Author

german-rios-gonzalez commented Aug 14, 2020

Sorry for the delay, but I think I screwed again, because I can't see any change, for example this is the value that I need to echo 0x0x040702?? or is 0x040702?

Do you prefer that I add the results as an attachment?

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x040702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x040702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x040702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x040702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x080702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x080702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x080702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x080702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x100702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x100702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x0x100702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x0x100702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

@aymanbagabas
Copy link
Owner

No, it's gonna be in this form 0x080702

@german-rios-gonzalez
Copy link
Author

My bad, here are the results now

Keyboard backlight level 2 and 0x04:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x040702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x040702

[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x040702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x040702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

Keyboard backlight level 2 and 0x08:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x080702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x080702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x080702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x080702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

Keyboard backlight level 2 and 0x10:

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x100702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x100702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

[german.rios.gonzalez@Huawei-NBL-WAQ9R ~]$ echo 0x100702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
0x100702
[root@Huawei-NBL-WAQ9R ~]# cat /sys/kernel/debug/huawei-wmi/call
[{0x00,0x00,0x00,0x00},{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}]

@aymanbagabas
Copy link
Owner

aymanbagabas commented Aug 14, 2020 via email

@german-rios-gonzalez
Copy link
Author

Yeah, after the 0x04 the second time it turn off the backlight, the 0x08 the second time turn on the backlight in level 1, and the 0x10 the second time turn on the backlight on the level 2

@aymanbagabas
Copy link
Owner

@nekr0z can you confirm this is working on your machine?

@nekr0z
Copy link

nekr0z commented Aug 14, 2020

@nekr0z can you confirm this is working on your machine?

Yes and no. 0x04 followed by a call switches backight to full on my machine (no need to do the commands twice either, once is enough), while 0x08 and 0x10 do nothing. And neither of these commands do anything to the duration of the backlight.

@aymanbagabas
Copy link
Owner

I guess that's still good news! It means we can control the keyboard backlight from the software. I'll look more into the timeout duration.

@nekr0z
Copy link

nekr0z commented Aug 14, 2020

As for the timeout duration, I don't believe this option was available before 2020, so it may be exclusive to the newer models. I definitely remember the corresponding woes on a forum dedicated to WRT-W19.

That being said, it's cool that keyboard backlight can be controlled from software — even on my model (and I guess on MBX as well?); it's even more cool that at least new models allow for backlight duration control; and it's absolutely great that you're on the right track to figuring these things out. ;)

Don't hesitate to ping me if anything needs testing on a WRT-W19.

@aymanbagabas
Copy link
Owner

@german-rios-gonzalez can you provide a sudo dmidecode for your computer? I need the device's dmi id to match against it in the driver.

@german-rios-gonzalez
Copy link
Author

Hi @aymanbagabas off course

dmidecode 3.2

Getting SMBIOS data from sysfs.
SMBIOS 3.11.1 present.

SMBIOS implementations newer than version 3.2.0 are not

fully supported by this version of dmidecode.

Table at 0xAE2DD000.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
Vendor: HUAWEI
Version: 1.07
Release Date: 06/02/2020
Address: 0xE0000
Runtime Size: 128 kB
ROM Size: 8 MB
Characteristics:
PCI is supported
PNP is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
EDD is supported
ACPI is supported
USB legacy is supported
Smart battery is supported
BIOS boot specification is supported
Targeted content distribution is supported
UEFI is supported
BIOS Revision: 1.7
Firmware Revision: 1.7

Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: HUAWEI
Product Name: NBLK-WAX9X
Version: M1010
Serial Number: M6TPM20429000448
UUID: ed2f74d6-1c64-49e2-b46f-82706b52d9dc
Wake-up Type: Power Switch
SKU Number: C331
Family: MateBook D

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
Manufacturer: HUAWEI
Product Name: NBLK-WAX9X-PCB
Version: M1010
Serial Number: PM03C0204R006015
Asset Tag: NULL
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: NULL
Chassis Handle: 0x0003
Type: Motherboard
Contained Object Handles: 0

Handle 0x0003, DMI type 3, 23 bytes
Chassis Information
Manufacturer: HUAWEI
Type: Notebook
Lock: Not Present
Version: M1010
Serial Number: M6TPM20429000448
Asset Tag: NULL
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
OEM Information: 0x00000000
Height: Unspecified
Number Of Power Cords: 1
Contained Elements: 0
SKU Number: NobelK-WAQ9BR

Handle 0x0004, DMI type 4, 48 bytes
Processor Information
Socket Designation: FP5
Type: Central Processor
Family: Zen
Manufacturer: Advanced Micro Devices, Inc.
ID: 81 0F 81 00 FF FB 8B 17
Signature: Family 23, Model 24, Stepping 1
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
MMX (MMX technology supported)
FXSR (FXSAVE and FXSTOR instructions supported)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
HTT (Multi-threading)
Version: AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
Voltage: 1.2 V
External Clock: 100 MHz
Max Speed: 3700 MHz
Current Speed: 2100 MHz
Status: Populated, Enabled
Upgrade: None
L1 Cache Handle: 0x0005
L2 Cache Handle: 0x0006
L3 Cache Handle: 0x0007
Serial Number: NULL
Asset Tag: NULL
Part Number: NULL
Core Count: 4
Core Enabled: 4
Thread Count: 8
Characteristics:
64-bit capable
Multi-Core
Hardware Thread
Execute Protection
Enhanced Virtualization
Power/Performance Control

Handle 0x0005, DMI type 7, 27 bytes
Cache Information
Socket Designation: L1 - Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 384 kB
Maximum Size: 384 kB
Supported SRAM Types:
Pipeline Burst
Installed SRAM Type: Pipeline Burst
Speed: 1 ns
Error Correction Type: Multi-bit ECC
System Type: Unified
Associativity: 8-way Set-associative

Handle 0x0006, DMI type 7, 27 bytes
Cache Information
Socket Designation: L2 - Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 2 MB
Maximum Size: 2 MB
Supported SRAM Types:
Pipeline Burst
Installed SRAM Type: Pipeline Burst
Speed: 1 ns
Error Correction Type: Multi-bit ECC
System Type: Unified
Associativity: 8-way Set-associative

Handle 0x0007, DMI type 7, 27 bytes
Cache Information
Socket Designation: L3 - Cache
Configuration: Enabled, Not Socketed, Level 3
Operational Mode: Write Back
Location: Internal
Installed Size: 4 MB
Maximum Size: 4 MB
Supported SRAM Types:
Pipeline Burst
Installed SRAM Type: Pipeline Burst
Speed: 1 ns
Error Correction Type: Multi-bit ECC
System Type: Unified
Associativity: 16-way Set-associative

Handle 0x0008, DMI type 9, 17 bytes
System Slot Information
Designation: PCI-1
Type: x1 PCI Express x1
Current Usage: In Use
Length: Other
ID: 1
Characteristics:
PME signal is supported
Hot-plug devices are supported
Bus Address: 0000:01:00.0

Handle 0x0009, DMI type 9, 17 bytes
System Slot Information
Designation: PCI-2
Type: x4 PCI Express 3 x4
Current Usage: In Use
Length: Other
ID: 2
Characteristics:
PME signal is supported
Hot-plug devices are supported
Bus Address: 0000:02:00.0

Handle 0x000A, DMI type 11, 5 bytes
OEM Strings
String 1: $HUA001MX10000
String 2: OemString2
String 3: OemString3
String 4: OemString4

Handle 0x000B, DMI type 13, 22 bytes
BIOS Language Information
Language Description Format: Long
Installable Languages: 2
zh|CN|unicode,0
en|US|iso8859-1,0
Currently Installed Language: en|US|iso8859-1,0

Handle 0x000C, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 64 GB
Error Information Handle: Not Provided
Number Of Devices: 2

Handle 0x000D, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x000C
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4 GB
Form Factor: Row Of Chips
Set: None
Locator: DIMM 0
Bank Locator: P0 CHANNEL A
Type: DDR4
Type Detail: Synchronous Unbuffered (Unregistered)
Speed: 2667 MT/s
Manufacturer: Samsung
Serial Number: 00000000
Asset Tag: Not Specified
Part Number: M471A5244CB0-CTD
Rank: 1
Configured Memory Speed: 2400 MT/s
Minimum Voltage: 1.2 V
Maximum Voltage: 1.2 V
Configured Voltage: 1.2 V

Handle 0x000E, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x000C
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4 GB
Form Factor: Row Of Chips
Set: None
Locator: DIMM 0
Bank Locator: P0 CHANNEL B
Type: DDR4
Type Detail: Synchronous Unbuffered (Unregistered)
Speed: 2667 MT/s
Manufacturer: Samsung
Serial Number: 00000000
Asset Tag: Not Specified
Part Number: M471A5244CB0-CTD
Rank: 1
Configured Memory Speed: 2400 MT/s
Minimum Voltage: 1.2 V
Maximum Voltage: 1.2 V
Configured Voltage: 1.2 V

Handle 0x000F, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown

Handle 0x0010, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown

Handle 0x0011, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown

Handle 0x0012, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x001FFFFFFFF
Range Size: 8 GB
Physical Array Handle: 0x000C
Partition Width: 2

Handle 0x0013, DMI type 20, 35 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x001FFFFFFFF
Range Size: 8 GB
Physical Device Handle: 0x000D
Memory Array Mapped Address Handle: 0x0012
Partition Row Position: Unknown
Interleave Position: Unknown
Interleaved Data Depth: Unknown

Handle 0x0014, DMI type 20, 35 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x001FFFFFFFF
Range Size: 8 GB
Physical Device Handle: 0x000E
Memory Array Mapped Address Handle: 0x0012
Partition Row Position: Unknown
Interleave Position: Unknown
Interleaved Data Depth: Unknown

Handle 0x0015, DMI type 21, 7 bytes
Built-in Pointing Device
Type: Touch Pad
Interface: Other
Buttons: 2

Handle 0x0016, DMI type 22, 26 bytes
Portable Battery
Location: Rear cover inside
Manufacturer: Desay
Manufacture Date: 3/4/2020
Serial Number: 1
Name: HB4692Z9ECW-41
Chemistry: Lithium Ion
Design Capacity: 0 mWh
Design Voltage: 15280 mV
SBDS Version: Not Specified
Maximum Error: 1%
OEM-specific Information: 0x00000048

Handle 0x0017, DMI type 43, 31 bytes
TPM Device
Vendor ID: AMD
Specification Version: 2.0
Firmware Revision: 3.34
Description: TPM Device
Characteristics:
TPM Device characteristics not supported
OEM-specific Information: 0x00000000

Handle 0xFEFF, DMI type 127, 4 bytes
End Of Table

@aymanbagabas
Copy link
Owner

Please try https://github.com/aymanbagabas/Huawei-WMI/tree/feat/kbdlight and report the behavior. FYI, I haven't tested it on my machine (I don't have it on me at the moment) so you might encounter kernel panics 🤞

@nekr0z I'd love it if you can test this too. You'd need to load the driver with handle_kbdlight=1 or use the sysfs interface because your device handles this somewhere else, assuming the BIOS, the same goes to my device MACH-WX9. The sysfs interface takes 0, 1, or 2 for off, level 1, level 2 respectively.

@nekr0z
Copy link

nekr0z commented Oct 20, 2020

Ooh, interesting, it works! Well, somewhat. ;-)

I installed the patched driver onto my machine and rebooted. Nothing new.

Then, I rmmoded the driver and insmoded it with handle_kbdlight=1. kbdlight interface appeared under /sys/devices/platform/huawei-wmi/. So far so good.

Now, my WRT-W19 has 3 modes of keyboard lighting: "off" (self-explanatory), "half" (low brighness for about 15 seconds, then turning off), and "full" (bright about 15 seconds, then turning off). The modes are controlled by a dedicated key (combined with F3) and switch in cycle, with one caveat: if the keyboard is in "half" or "full" mode and the lighting has timed out, pushing the key doesn't switch to the next mode, it only turns the lighting on.

Well, here are the results of my playing with kbdlight interface:

  • reads (all the results reproduce reliably, no one-offs):
    • keyboard in "off":
      $ cat /sys/devices/platform/huawei-wmi/kbdlight
      cat: /sys/devices/platform/huawei-wmi/kbdlight: No such device
      
    • keyboard in "half":
      $ cat /sys/devices/platform/huawei-wmi/kbdlight
      3
      
    • keyboard in "full":
      $ cat /sys/devices/platform/huawei-wmi/kbdlight
      4
      
  • writes (all the results reproduce reliably, behavior independent of what the keyboard lighting is initially set to):
    • $ echo 0 | sudo tee /sys/devices/platform/huawei-wmi/kbdlight
      0
      
      sets keyboard to "full"
    • $ echo 1 | sudo tee /sys/devices/platform/huawei-wmi/kbdlight
      1
      tee: /sys/devices/platform/huawei-wmi/kbdlight: No such device
      
      does not change the keyboard lighting setting
    • $ echo 2 | sudo tee /sys/devices/platform/huawei-wmi/kbdlight
      2
      tee: /sys/devices/platform/huawei-wmi/kbdlight: No such device
      
      does not change the keyboard lighting setting
    • $ echo 3 | sudo tee /sys/devices/platform/huawei-wmi/kbdlight
      3
      tee: /sys/devices/platform/huawei-wmi/kbdlight: Invalid argument
      
      does not change the keyboard lighting setting, also true for all the other values I've tried

@german-rios-gonzalez
Copy link
Author

Hi @aymanbagabas, I don't know if I do it all ok, but the keyboard can cycle through the 3 levels of backlight, from off, to medium, to maximum, and the timeout it's off 💃, and there isn't kernel panics signals yet, I'm going to work all day and be right back if anything went wrong

@aymanbagabas
Copy link
Owner

aymanbagabas commented Nov 15, 2020

I finally was able to run this on my machine (MACH-WX9) and I see a couple of differences.

    Method (GLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100){})
        Local0 = Arg0
        CreateByteField (BUFF, Zero, STAT)
        CreateByteField (BUFF, One, AMLL)
        CreateByteField (BUFF, 0x02, KBLL)
        AMLL = 0xFF
        KBLL = \_SB.PCI0.LPCB.EC0.RRAM (0x0C4F)
        STAT = Zero
        Return (BUFF) /* \GLIV.BUFF */
    }

    Method (SLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100){})
        Local0 = Arg0
        CreateByteField (Arg0, 0x02, SOCP)
        CreateByteField (BUFF, Zero, STAT)
        \_SB.PCI0.LPCB.EC0.WRAM (0x0C4F, SOCP)
        STAT = Zero
        Return (BUFF) /* \SLIV.BUFF */
    }

The return buf always returns buf[1] = 0xff and buf[2] has one of the following values 0x01 off, 0x02 level 1, and 0x04 level 2 which is different from what you have. It seems like older models have more quirks and edge cases. I will see what I can do.

@aymanbagabas
Copy link
Owner

@nekr0z could you please provide a dmidecode output? As this project keeps growing, it's becoming hard to keep track of which device is which. So I'm thinking of building a database of Huawei devices information in the wiki section of this repository.

dmidecode is used to identify platform devices in the kernel and the driver uses those to apply quirks to different devices. From what I've noticed, new devices report kbdlight button presses and they're handled through WMI as opposed to old ones which are handled in the firmware.

@aymanbagabas
Copy link
Owner

@german-rios-gonzalez your device doesn't seem to have \SKBT and \GKBT introduced in #44

@aymanbagabas
Copy link
Owner

@nekr0z @german-rios-gonzalez I've updated https://github.com/aymanbagabas/Huawei-WMI/tree/feat/kbdlight to fix some issues.

@nekr0z I've noticed that whenever I change kbdlight on my machine, the change does not take effect immediately like if it was on level 2 and I set it to off, it takes some time for the change to apply. This might be the case for you as well. However, I think this doesn't matter much because our devices already handle kbdlight just fine, though, it would be nice to control this from the software.

@german-rios-gonzalez
Copy link
Author

Hi, @aymanbagabas so far it's working without issues, I didn't notice any drawbacks, the time out it's off and the keyboard backlight it's always on

@sermart1234
Copy link
Collaborator

sermart1234 commented Nov 16, 2020

@aymanbagabas
Honor Magicbook Pro 2020.
Keyboard bachlight timeout

Try use kernel module ec_sys.

modprobe ec_sys write_support=1
od -Ax -t x1 /sys/kernel/debug/ec/ec0/io

Offset 0x18 - KBBH
Offset 0x19 - KBBL

0x32 = 50 = 5 seconds
image

0x012C = 300 = 30 seconds
image

@sermart1234
Copy link
Collaborator

@aymanbagabas also Honor Magicbook 2019
Honor Magicbook 2019 BIOS 1.12.zip

@aymanbagabas
Copy link
Owner

echo 0x00000702 | sudo tee /sys/kernel/debug/huawei-wmi/arg
sudo cat /sys/kernel/debug/huawei-wmi/call
sudo cat /sys/kernel/debug/huawei-wmi/call
echo 0x00000602 | sudo tee /sys/kernel/debug/huawei-wmi/arg
sudo cat /sys/kernel/debug/huawei-wmi/call
sudo cat /sys/kernel/debug/huawei-wmi/call

@sermart1234 Could you test this on a Honor Magicbook 2019?

@aymanbagabas
Copy link
Owner

Hello,

ive bought a Matebook 13 2020 recently and got the exact same problem with 15 second keyboard backlight timing.
Can anyone please tell me how to disable the timing on a windows machine?

I only registered to ask this on this Forum. :-)

@keltkelt I need to peek through your laptop's ACPI tables. Could you please provide a acpidump and a dmidecode outputs?

sudo acpidump > acpidump.out
dmidecode > dmidecode.txt

@aymanbagabas
Copy link
Owner

@sermart1234 I'm still surprised why \SLIV and \GLIV are not working. Because following the logic in these functions should return a value unless there is something I'm not seeing.

You call the WMI interface method, WMAA using 0x00000702 0x02 is the MFID, 0x07 is the SFID, and 0x00 is the first argument to the function. In this case, 0x0702 is \SLIV and the first argument is 0x00 zero.

                        Case (0x02)
                        {
                            Switch (SFID)
                            {
                                Case (One)
                                {
                                    Local0 = GTSI /* External reference */
                                    Local1
                                }
                                ...
                                Case (0x06)
                                {
                                    Local0 = GLIV /* External reference */
                                    Local1
                                }
                                Case (0x07)
                                {
                                    Local0 = SLIV /* External reference */
                                    Local1
                                }

Now here \SLIV takes one argument and parses the bytes, the argument being 0x00000702. It looks for the third byte in the first argument and that's 0x00. Now, this should match the first if statement and call ECM3 and ECD3 respectively. Finally returns the buffer with a zero STAT value.

    Method (SLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100) {})
        Local0 = Arg0
        CreateByteField (Arg0, 0x02, KBBV)
        CreateByteField (BUFF, Zero, STAT)
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        If ((KBBV == Zero))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (0x04)
            STAT = Zero
        }
        ElseIf ((KBBV == 0x02))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (0x08)
            STAT = Zero
        }
        ElseIf ((KBBV == 0x04))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (0x10)
            STAT = Zero
        }
        Else
        {
            STAT = One
        }

        Release (\_SB.PCI0.LPC0.EC0.ECMT)
        Return (BUFF) /* \SLIV.BUFF */
    }

ECD3 sets the first argument to ECXD, this case it should be 0x04.

                    Method (ECD3, 1, Serialized)
                    {
                        IBE3 ()
                        ECXD = Arg0
                        IBE3 ()
                    }

Now when you look at \GLIV, it checks for the value in ECXD. Don't confuse yourself with KBBL here, it is just the variable name of the third byte in the returned buffer`

    Method (GLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100) {})
        Name (CONT, Zero)
        Local0 = Arg0
        CreateByteField (BUFF, Zero, STAT)
        CreateByteField (BUFF, One, SURV)
        CreateByteField (BUFF, 0x02, KBBL)
        CONT = Zero
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        \_SB.PCI0.LPC0.EC0.ECM3 (0xC4)
        While (((CONT != 0x0A) && ((\_SB.PCI0.LPC0.EC0.ECXC & One) == Zero)))
        {
            CONT += One
            Sleep (0x32)
        }

        If ((\_SB.PCI0.LPC0.EC0.ECXD == 0x04))
        {
            KBBL = Zero
            STAT = Zero
        }
        ElseIf ((\_SB.PCI0.LPC0.EC0.ECXD == 0x08))
        {
            KBBL = 0x32
            STAT = Zero
        }
        ElseIf ((\_SB.PCI0.LPC0.EC0.ECXD == 0x10))
        {
            KBBL = 0x64
            STAT = Zero
        }
        Else
        {
            STAT = One
        }

        Release (\_SB.PCI0.LPC0.EC0.ECMT)
        Return (BUFF) /* \GLIV.BUFF */
    }

ECXD is defined in the ECIO EC region. I'm not sure if you can access this EC region but you might be able to using RWEverything or ec_sys.

I've also found an unmerged patch that might help in further debug this https://www.spinics.net/lists/platform-driver-x86/msg00525.html. The patch has gone to a v3 and is dated to 2010. ECIO is defined below.

                    OperationRegion (ECIO, SystemIO, 0x60, 0x10)
                    Field (ECIO, ByteAcc, NoLock, Preserve)
                    {
                        Offset (0x02), 
                        DATP,   8, 
                        Offset (0x06), 
                        CMDS,   8, 
                        Offset (0x08), 
                        ECXD,   8, 
                        Offset (0x0C), 
                        ECXC,   8
                    }

@sermart1234
Copy link
Collaborator

@aymanbagabas, GLIV return buffer very slow.

\_SB.PCI0.LPC0.EC0.ECM3 (0xC4)
While (((CONT != 0x0A) && ((\_SB.PCI0.LPC0.EC0.ECXC & One) == Zero)))
        {
            CONT += One
            Sleep (0x32)
        }

ECXC & One equal to Zero, but

Method (SLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100){})
        Local0 = Arg0
        CreateByteField (Arg0, 0x02, KBBV)
        CreateByteField (BUFF, Zero, STAT)
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        If ((KBBV == Zero))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
Method (ECM3, 1, Serialized)
                    {
                        IBE3 ()
                        ECXC = Arg0
                        IBE3 ()
                    }

I think, something is constantly changing the ECXC value

@sermart1234
Copy link
Collaborator

@aymanbagabas, how I can call \SLIV and \GLIV on Windows?

@aymanbagabas
Copy link
Owner

@aymanbagabas, how I can call \SLIV and \GLIV on Windows?

You gotta switch to Windows kernel-mode and setup windbg, then use the AMLI tool to call ACPI methods. See these examples.

On Linux, I use acpiexec to simulate other devices tables and use acpi_call to debug my device.

@Nonta72
Copy link

Nonta72 commented Jan 2, 2021

Hi,

I would like to thank you for the initiative because the timeout pseudo-feature is really annoying.
I have a similar device to those mentionned in the issue except mine is a MagicBook 14 2018 (VLT-WX0).

I tried to compile the module using the branch mentionned here #38 (comment) but no kbdlight interface appears under /sys/devices/platform/huawei-wmi (I tried rmmod and insmod the driver as referenced here #38 (comment))

I have also tried sermart1234's repository (https://github.com/sermart1234/Huawei-WMI) but the kbdlight_timeout doesn't appear in interfaces.

Could you please have a look and help me with this? I have attached the acpI files.
))
Thanks

acpi.zip

@aymanbagabas
Copy link
Owner

Hi @Nonta72,

As you can see in this discussion, the state of kbdlight and kbdlight_timeout is inconsistent across these devices, my device in particular doesn't have such functionality so I can't really test these things. @sermart1234 did a good job in implementing both functionalities but it's only been tested on his device AFAICT.

@Nonta72
Copy link

Nonta72 commented Jan 4, 2021

Hi @Nonta72,

As you can see in this discussion, the state of kbdlight and kbdlight_timeout is inconsistent across these devices, my device in particular doesn't have such functionality so I can't really test these things. @sermart1234 did a good job in implementing both functionalities but it's only been tested on his device AFAICT.

It seems like it's indeed inconsistent
Did your device come with an option to disable the kb timeout in windows?
It seems like devices released in 2020 have that option in Windows through the proprietary bloatware called PC Manager.
That means BIOS already allows such modifications through software depending on the operating system.
Mine never worked with such software in Windows and Huawei's only answer was that "It's not possible with devices released before 2020".
So, I'm thinking that might be the main reason too unless I'm wrong. I've updated bios to 1.26 (the most recent) and \SLIV or \GLIV don't appear in the ACPI tables.

@aymanbagabas
Copy link
Owner

Did your device come with an option to disable the kb timeout in windows?

No, it didn't. But the BIOS contains the kbdlight control methods, although they behave weirdly. Changing the backlight doesn't take effect immediately.

It seems like you're right about devices released before 2020. If someone could make a PR for applying a quirk that disables kbdlight and kbdlight_timeout functionality for these devices in the feat/kbdlight branch then we could test it and verify that it works before submitting it to the Linux x86-platform mailing list.

@Nonta72
Copy link

Nonta72 commented Aug 3, 2021

No, it didn't. But the BIOS contains the kbdlight control methods, although they behave weirdly. Changing the backlight doesn't take effect immediately.

I still don't understand something, you have a Matebook from 2018 (the PRO version). I have the normal version from the same year. The design and components are pretty close (except the size I guess). Yet you have the option working with the driver. Which BIOS version are you on? And how did you exactly find the references to keyboard backlight? I checked all ACPI files (from DSDT to SSDT) and checked the EFI variables with no specific reference to keyboard backlight.

@aymanbagabas
Copy link
Owner

After analyzing multiple ACPI files for different devices, I noticed that there is a common ACPI device that defines a unified interface HWMI. This interface is a WMI interface that has a function that takes 3 parameters. The first two are unused and I believe they're just a requirement for WMI. The 3rd parameter is a 64-bit integer with 8 parameters in little-endian format (though most of the time only half of the integer is used 4 parameters 32-bit). The first and second parameters are the interface function IDs. The other 2 are the interface function parameters.

Here's what it looks like from my ACPI tables:

            Method (WMAA, 3, Serialized)
            {
                Acquire (MUTW, 0xFFFF)
                Name (WMRP, Package (0x02)
                {
                    Buffer (0x04){}, 
                    Buffer (0x0100){}
                })
                Local0 = Arg2
                CreateByteField (Local0, Zero, MFID)
                CreateByteField (Local0, One, SFID)
                Local1 = DerefOf (WMRP [One])
                CreateByteField (Local1, Zero, STAT)
                STAT = One
                Switch (MFID)
                {
                    Case (One)
                    {
                        Switch (SFID)
                        {
                            Case (One)
                            {
                                Local1 = GVER (Local0)
                            }

                        }
                    }
                    Case (0x02)
                    {
                        Switch (SFID)
                        {
                            Case (One)
                            ...
                            Case (0x02)
                            ...
                            Case (0x03)
                            ...
                            Case (0x04)
                            ...
                            Case (0x05)
                            ...
                            Case (0x06)
                            {
                                Local1 = GLIV (Local0)
                            }
                            Case (0x07)
                            {
                                Local1 = SLIV (Local0)
                            }
                            Case (0x08)
                            ...
                        }
                    ...
                    Case (0x04)
                    {
                        Switch (SFID)
                        {
                            ...
                            Case (0x06)
                            {
                                Local1 = GFRS (Local0)
                            }
                            Case (0x07)
                            {
                                Local1 = SFRS (Local0)
                            }
                        ...
                    }
                }

You can see that it switches on the first 2 parameters and then calls another function with the same WMI function parameter. These functions are defined in the DSDT table. In this example, you can see how the FN_LOCK command work. huawei-wmi.c defines FN_LOCK commands as 0x00000604 and 0x00000704. Interpreting the 1st command in little-endian would give us [0x04, 0x06, 0x00, 0x00]. The first 2 arguments are used to switch between different functions in the interface function. As you can see, 0x04 and 0x06 would call GFRS (Local0) which is defined in DSDT. The other two arguments are later used in union hwmi_arg to pass parameters to the targeted WMI function in the interface.

I would imagine using Ghidra or IDA to reverse-engineer Huawei PC Manager and WinDbg in kernel-mode would lead you more in the right direction to figure out how everything is tied up together.

I hope this helps explain how all this works. Let me know if you have any other questions. Different devices have different implementations for each function. You can refer to the WIKI for my collection of ACPI tables for different Huawei devices.

@wachodurango
Copy link

After analyzing multiple ACPI files for different devices, I noticed that there is a common ACPI device that defines a unified interface HWMI. This interface is a WMI interface that has a function that takes 3 parameters. The first two are unused and I believe they're just a requirement for WMI. The 3rd parameter is a 64-bit integer with 8 parameters in little-endian format (though most of the time only half of the integer is used 4 parameters 32-bit). The first and second parameters are the interface function IDs. The other 2 are the interface function parameters.

Here's what it looks like from my ACPI tables:

            Method (WMAA, 3, Serialized)
            {
                Acquire (MUTW, 0xFFFF)
                Name (WMRP, Package (0x02)
                {
                    Buffer (0x04){}, 
                    Buffer (0x0100){}
                })
                Local0 = Arg2
                CreateByteField (Local0, Zero, MFID)
                CreateByteField (Local0, One, SFID)
                Local1 = DerefOf (WMRP [One])
                CreateByteField (Local1, Zero, STAT)
                STAT = One
                Switch (MFID)
                {
                    Case (One)
                    {
                        Switch (SFID)
                        {
                            Case (One)
                            {
                                Local1 = GVER (Local0)
                            }

                        }
                    }
                    Case (0x02)
                    {
                        Switch (SFID)
                        {
                            Case (One)
                            ...
                            Case (0x02)
                            ...
                            Case (0x03)
                            ...
                            Case (0x04)
                            ...
                            Case (0x05)
                            ...
                            Case (0x06)
                            {
                                Local1 = GLIV (Local0)
                            }
                            Case (0x07)
                            {
                                Local1 = SLIV (Local0)
                            }
                            Case (0x08)
                            ...
                        }
                    ...
                    Case (0x04)
                    {
                        Switch (SFID)
                        {
                            ...
                            Case (0x06)
                            {
                                Local1 = GFRS (Local0)
                            }
                            Case (0x07)
                            {
                                Local1 = SFRS (Local0)
                            }
                        ...
                    }
                }

You can see that it switches on the first 2 parameters and then calls another function with the same WMI function parameter. These functions are defined in the DSDT table. In this example, you can see how the FN_LOCK command work. huawei-wmi.c defines FN_LOCK commands as 0x00000604 and 0x00000704. Interpreting the 1st command in little-endian would give us [0x04, 0x06, 0x00, 0x00]. The first 2 arguments are used to switch between different functions in the interface function. As you can see, 0x04 and 0x06 would call GFRS (Local0) which is defined in DSDT. The other two arguments are later used in union hwmi_arg to pass parameters to the targeted WMI function in the interface.

I would imagine using Ghidra or IDA to reverse-engineer Huawei PC Manager and WinDbg in kernel-mode would lead you more in the right direction to figure out how everything is tied up together.

I hope this helps explain how all this works. Let me know if you have any other questions. Different devices have different implementations for each function. You can refer to the WIKI for my collection of ACPI tables for different Huawei devices.

That's an amazing work. I have a MACH-WX9 (2018) if you want me to run some tests or something like that.

@www159
Copy link

www159 commented Mar 17, 2023

@aymanbagabas
matebook D14 ryzen5(2020)
dmidecode

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: HUAWEI
        Product Name: NBLL-WXX9
        Version: M1040
        Serial Number: 6DSPM20720001666
        UUID: 1b7bd74e-311e-48b1-b92e-18d7676f51af
        Wake-up Type: Power Switch
        SKU Number: C233
        Family: MateBook D

GLIV and SLIV in DSDT:

    Method (GLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100) {})
        Name (CONT, Zero)
        Local0 = Arg0
        CreateByteField (BUFF, Zero, STAT)
        CreateByteField (BUFF, One, SURV)
        CreateByteField (BUFF, 0x02, KBBL)
        CONT = Zero
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        \_SB.PCI0.LPC0.EC0.ECM3 (0xC4)
        While (((CONT != 0x0A) && ((\_SB.PCI0.LPC0.EC0.ECXC & One) == Zero)))
        {
            CONT += One
            Sleep (0x32)
        }

        If ((\_SB.PCI0.LPC0.EC0.ECXD == 0x04))
        {
            KBBL = Zero
            STAT = Zero
        }
        ElseIf ((\_SB.PCI0.LPC0.EC0.ECXD == 0x08))
        {
            KBBL = 0x32
            STAT = Zero
        }
        ElseIf ((\_SB.PCI0.LPC0.EC0.ECXD == 0x10))
        {
            KBBL = 0x64
            STAT = Zero
        }
        Else
        {
            STAT = One
        }

        Release (\_SB.PCI0.LPC0.EC0.ECMT)
        Return (BUFF) /* \GLIV.BUFF */
    }

    Method (SLIV, 1, NotSerialized)
    {
        Name (BUFF, Buffer (0x0100) {})
        Local0 = Arg0
        CreateByteField (Arg0, 0x02, KBBV)
        CreateByteField (BUFF, Zero, STAT)
        Acquire (\_SB.PCI0.LPC0.EC0.ECMT, 0x03E8)
        If ((KBBV == Zero))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (0x04)
            STAT = Zero
        }
        ElseIf ((KBBV == 0x02))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (0x08)
            STAT = Zero
        }
        ElseIf ((KBBV == 0x04))
        {
            \_SB.PCI0.LPC0.EC0.ECM3 (0xC5)
            \_SB.PCI0.LPC0.EC0.ECD3 (0x10)
            STAT = Zero
        }
        Else
        {
            STAT = One
        }

        Release (\_SB.PCI0.LPC0.EC0.ECMT)
        Return (BUFF) /* \SLIV.BUFF */
    }

I met the same situation as @nekr0z that I can set the timeout but cannot set the kbdlight.

@www159
Copy link

www159 commented Mar 17, 2023

entry in ssdt7

                        Case (0x02)
                        {
                                ...
                                Case (0x06)
                                {
                                    Local0 = GLIV /* External reference */
                                    Local1
                                }
                                Case (0x07)
                                {
                                    Local0 = SLIV /* External reference */
                                    Local1
                                }
                                ...
                       }

@www159
Copy link

www159 commented Mar 17, 2023

@www159
Copy link

www159 commented Mar 18, 2023

I guess the method is designed for certain categories. There might be no physics interfaces for keyboard backlight featuring with timeout to set brightless level.

@www159
Copy link

www159 commented Mar 18, 2023

It seems like timer unit has occupied the registers of led unit, which could be used to set the brightless level. All above could be proved if get the pcb spec.

@sermart1234
Copy link
Collaborator

I met the same situation as @nekr0z that I can set the timeout but cannot set the kbdlight.

@www159 Can you do this on windows?

@SandaruKasa
Copy link

Hello!

Admittedly, I haven't read all the messages in this issue, but I have a Matebook D 16 (HVY-WXX9-PCB) with AMD Ryzen 5 4600H, running Arch Linux, with whatever latest kernel they are providing (6.2.13 as of now). This kernel seems to ship some version of huawei-wmi, but it doesn't really allow me to do much other than change screen brightness, lock fn, and turn micmute led on and off (speaking of which, for some reason it doesn't turn on and off when I mute and unmute mic, but I am still able to use /sys/devices/platform/huawei-wmi/leds/platform::micmute; I guess it's KDE's fault for not integrating the led with the mic mute, but I may be wrong).

So I've used the huawei-wmi-dkms-kbdlight-git AUR package to install this module's version from the kbdlight branch of the repo.

And I am happy to report that /sys/devices/platform/huawei-wmi/kbdlight_timeout works for me! It even persists after reboots. Thank you so much!

However, I still have two small issues:

  1. The micmute led I've mentioned above. I can toggle it manually, but it doesn't do it automatically. Who should I annoy about this? KDE?
  2. I would love if it was possible to make Fn only active when it is being held down, instead of toggling on and off whenever it is pressed. I am not sure if this possible to do even on Windows, but maybe there's a chance

@pooh2pooh
Copy link

hello everyone!

I agree, the backlight timeout is very annoying. I have a Matebook 13 AMD 2020 (HN-WX9X) and after installing the package from aur huawei-wmi-dkms-kbdlight-git there is no kbdlight_timeout switch, only kbdlight which is equal:
no such device - backlight off
3 - backlight halfway
4 - full backlight
if you need any additional data, you are welcome to test

Thx!

@SandaruKasa
Copy link

hello everyone!

I agree, the backlight timeout is very annoying. I have a Matebook 13 AMD 2020 (HN-WX9X) and after installing the package from aur huawei-wmi-dkms-kbdlight-git there is no kbdlight_timeout switch, only kbdlight which is equal: no such device - backlight off 3 - backlight halfway 4 - full backlight if you need any additional data, you are welcome to test

Thx!

Did you dkms install --force the module? I think otherwise you will just have the older version that is shipped with the Kernel.

@pooh2pooh
Copy link

hello everyone!
I agree, the backlight timeout is very annoying. I have a Matebook 13 AMD 2020 (HN-WX9X) and after installing the package from aur huawei-wmi-dkms-kbdlight-git there is no kbdlight_timeout switch, only kbdlight which is equal: no such device - backlight off 3 - backlight halfway 4 - full backlight if you need any additional data, you are welcome to test
Thx!

Did you dkms install --force the module? I think otherwise you will just have the older version that is shipped with the Kernel.

Without this module, there are no these switches

@sermart1234
Copy link
Collaborator

sermart1234 commented Oct 21, 2023

@lemonup
Copy link

lemonup commented Jan 24, 2024

@aymanbagabas

I have matebook 16s, here is my dmidecode
is it possible that you add support for this laptop too?
if you need extra tests or data I'll send it

thanks!
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: HUAWEI
Product Name: CREFG-XX
Version: M1010
Serial Number: 46MPM23B10000267
UUID: e3ef0cc8-1e6e-4ce3-809e-d0d36aa67136
Wake-up Type: Other
SKU Number: C170
Family: MateBook

@sermart1234
Copy link
Collaborator

@lemonup, send acpidump please

@lemonup
Copy link

lemonup commented Jan 24, 2024

sudo acpidump > acpidump.txt
is this format ok?

acpidump.tar.gz

@Dmitry-Eremeev
Copy link

I'd like to help in troubleshooting.
Please see diagnostics info.
acpidump.txt

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