Contribute
Register

[Guide] Using Clover to "hotpatch" ACPI

Brigthness control keys are usually done by patching the appropriate _Qxx methods.
Use Rename/Replace pattern.

In static patch I use these _Qxx method:
Code:
Scope (_SB.PCI0.LPCB.EC0)
    {
        Method (_Q12, 0, NotSerialized)  // _Qxx: EC Query
        {
            Notify (PS2K, 0x0206)
            Notify (PS2K, 0x0286)
        }

        Method (_Q11, 0, NotSerialized)  // _Qxx: EC Query
        {
            Notify (PS2K, 0x0205)
            Notify (PS2K, 0x0285)
        }
The problem is that I don't know how transform this in HEX values....o_O
 
In static patch I use these _Qxx method:
Code:
Scope (_SB.PCI0.LPCB.EC0)
    {
        Method (_Q12, 0, NotSerialized)  // _Qxx: EC Query
        {
            Notify (PS2K, 0x0206)
            Notify (PS2K, 0x0286)
        }

        Method (_Q11, 0, NotSerialized)  // _Qxx: EC Query
        {
            Notify (PS2K, 0x0205)
            Notify (PS2K, 0x0285)
        }
The problem is that I don't know how transform this in HEX values....o_O

Read post #1. It is covered there... (Rename/Replace pattern).
 
(Rename/Replace pattern)
It's right?

Code:
allan:~ allan$ echo -n _Q12|xxd
0000000: 5f51 3132                                _Q12
allan:~ allan$ echo -n _Q11|xxd
0000000: 5f51 3131                                _Q11
allan:~ allan$

Oops sorry....
I realised that's wrong :oops:
 
Last edited:
Hmmm, sorry but I don't understand how I can call the method/Device name in Terminal.
And transform it to HEX value.

Like you did here:
Code:
// _Q13 called on brightness/mirror display key
        Method (_Q13, 0, Serialized)  // _Qxx: EC Query
        {
            External(\HKNO, FieldUnitObj)
            Store(HKNO, Local0)
            If (LEqual(Local0,7))
            {
                // Brightness Down
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0405)
            }
            If (LEqual(Local0,8))
            {
                // Brightness Up
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0406)
            }
            If (LEqual(Local0,4))
            {
                // Mirror toggle
                Notify(\_SB.PCI0.LPCB.PS2K, 0x046e)
            }
        }

To:
Comment: change Method(_Q13,0,S) to XQ13
Find: <5f513133 08>
Replace: <58513133 08>

:|
 
Hmmm, sorry but I don't understand how I can call the method/Device name in Terminal.
And transform it to HEX value.

Like you did here:
Code:
// _Q13 called on brightness/mirror display key
        Method (_Q13, 0, Serialized)  // _Qxx: EC Query
        {
            External(\HKNO, FieldUnitObj)
            Store(HKNO, Local0)
            If (LEqual(Local0,7))
            {
                // Brightness Down
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0405)
            }
            If (LEqual(Local0,8))
            {
                // Brightness Up
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0406)
            }
            If (LEqual(Local0,4))
            {
                // Mirror toggle
                Notify(\_SB.PCI0.LPCB.PS2K, 0x046e)
            }
        }

To:
Comment: change Method(_Q13,0,S) to XQ13
Find: <5f513133 08>
Replace: <58513133 08>

:|

Use Hex Fiend to verify your Find/Replace makes sense.
 
Now I got WiFi working (with ProBookAtheros.kext). :)

I has discovered here in Hex Fiend some values for _Qxx method, but if I inject the values that I've think's right, I got a KP.

Code:
<dict>
                    <key>Comment</key>
                    <string>Brightness Up</string>
                    <key>Disabled</key>
                    <false/>
                    <key>Find</key>
                    <data>
                    X1ExQw==
                    </data>
                    <key>Replace</key>
                    <data>
                    X1ExMg==
                    </data>
                </dict>
                <dict>
                    <key>Comment</key>
                    <string>Brightness Down</string>
                    <key>Disabled</key>
                    <false/>
                    <key>Find</key>
                    <data>
                    X1ExRA==
                    </data>
                    <key>Replace</key>
                    <data>
                    X1ExMQ==
                    </data>
                </dict>
 
Now I got WiFi working (with ProBookAtheros.kext). :)

I has discovered here in Hex Fiend some values for _Qxx method, but if I inject the values that I've think's right, I got a KP.

Code:
<dict>
                    <key>Comment</key>
                    <string>Brightness Up</string>
                    <key>Disabled</key>
                    <false/>
                    <key>Find</key>
                    <data>
                    X1ExQw==
                    </data>
                    <key>Replace</key>
                    <data>
                    X1ExMg==
                    </data>
                </dict>
                <dict>
                    <key>Comment</key>
                    <string>Brightness Down</string>
                    <key>Disabled</key>
                    <false/>
                    <key>Find</key>
                    <data>
                    X1ExRA==
                    </data>
                    <key>Replace</key>
                    <data>
                    X1ExMQ==
                    </data>
                </dict>

First patch renames _Q1C -> _Q12.
Second _Q1D -> _Q11.
Why?
Generally you would rename _Q1C->XQ1C and _Q1D->XQ1D.
There are probably existing _Q12 and _Q11 methods in the same scope, hence the KP (you just created an invalid AML).
 
Sorry, I thought that it was needed use the same names that I've used in my static DSDT patch.


Hmmm, now I need reorganized my brain again...

Read "Rename and Replace" in post #1. Carefully.
 
Back
Top