shiecldk / ASUS-ZenBook-Pro-Duo-15-OLED-UX582-Hackintosh

Hackintosh installation guide for ASUS ZenBook Pro Duo 15 OLED UX582
GNU General Public License v3.0
24 stars 2 forks source link

Need guide to fix keyboard brightness on comet lake - MacOS Monterey #15

Closed lvinist closed 1 year ago

lvinist commented 1 year ago

Can i get guide to fix my keyboard brightness control on asus K413FQ because it has same layout as your keyboard?

Qonfused commented 1 year ago

Interesting, it appears that it does. image

@lvinist Could you provide your device's DSDT? You can find some instructions on how to do so from windows here: https://dortania.github.io/Getting-Started-With-ACPI/Manual/dump.html#from-windows

The ACPI patches in this repository require disabling SMCLightSensor, which might be conflicting if you've tried using them.

lvinist commented 1 year ago

here is my DSDT.dsl. dsdt.zip

i have some problem debugging fn keys on my laptop because using acpidebug.kext is so different in opencore than it is on clover and I have no idea how to build SSDT on RMDT and EC Queries Method. If u need to look at my EFI you can go look it here https://github.com/lvinist/ASUS-K413FQ-Hackintosh

I've tried ur SSDT-AsusSMC and SSDT-FN, the keyboard backlight itself is working but can't change the value using keyboard. And I want some clean solution because our system is bit different and I'm sure that there are some declaration that's unused

Qonfused commented 1 year ago

You'll want to refer to SSDT-ATKD and SSDT-KBLC for controlling keyboard backlight (they're the same as what's used in this repo), though I'll give an explanation for how they work here:

Your FN+F7 key triggers the _Q0D method in your DSDT, which is what's used for controlling keyboard backlight:

57264 | Method (_Q0D, 0, NotSerialized)
57265 | {
57266 |     KBLU ()
57267 | }

Notably, this KBLU method (and many other FN keys) depend on a ATKP variable being enabled (set to 1). There's actually an INIT method under the ATKD section of your DSDT that does this, though you can also manually set its value like so:

SSDT-ATKD.dsl#L30-L32

(This is just an example showing all the relevant bits only):

External (ATKP, IntObj)
Scope (_SB)
{
    If (_OSI ("Darwin"))
    {
        // Enables media key EC methods (including KBLD and KBLU methods)
        // Reference: (ATKD.INIT)
        ATKP = One
    }
}

You'll want to use an ACPI rename in your config plist for renaming your previous _Q0D method to XQ0D to replace it for macOS (while keeping the previous method for windows). You can find an example of how this is implemented in the _Q0D method in the ATKD SSDT: SSDT-ATKD.dsl#L100-L127

(This is just an example showing all the relevant bits only):

External (_SB_.ATKD.IANE, MethodObj)
External (_SB_.KBLV, IntObj)
External (_SB_.PCI0.LPCB.EC0_, DeviceObj)
External (_SB_.PCI0.LPCB.EC0_.XQ0D, MethodObj)

Name (DKLV, One)
Scope (_SB.PCI0.LPCB.EC0)
{
    // FN + F7: Keyboard backlight slider
    Method (_Q0D, 0, Serialized)
    {
        If (_OSI ("Darwin"))
        {
            // Switch direction at min/max backlight
            Switch (ToInteger (KBLV))
            {
                Case (Zero) { DKLV = Zero }
                Case (0x0F) { DKLV = One }
            }

            // Brightness down
            If ((DKLV == One))
            {
                \_SB.ATKD.IANE (0xC5)
            }
            // Brightness up
            Else
            {
                \_SB.ATKD.IANE (0xC4)
            }
        }
        Else
        {
            XQ0D ()
        }
    }
}

^^ This has a DKLV variable that's used for switching backlight increment/decrement direction when reaching the min/max backlight levels (Zero and 0x0F). ^^^ The IANE methods are what are normally used for controlling keyboard backlight in the KBLU and KBLD DSDT methods, though 0xC4 is used rather than 0xC7 for incrementing backlight. Beyond that, this is just a re-implementation of existing methods.

Here is a reference for that ACPI rename if you're unfamiliar: config.plist -> ACPI > Patch

Qonfused commented 1 year ago

The KBLC SSDT implements a method used by the ASUSSMC kext, and it's SKBV method is responsible for actually writing the new backlight value.

You can ignore the SPLC, SPSW, or any of the screenpad EC methods like _Q31 or _Q32 in the ATKD SSDT. Other fixes in that SSDT should work using the same ACPI renames (sans those for _Q30, _Q31, _Q32).

lvinist commented 1 year ago

thank you so much sir, it's work after tinkering with the SSDT-KBLC and SSDT-ATKD, and i add ur method on fn key lock too. Here's my video on proof of working machine. https://photos.app.goo.gl/Ee4eW4oPkEg4pM1s9

And my EFI can be accessed here https://github.com/lvinist/ASUS-K413FQ-Hackintosh