Contribute
Register

[Guide] Using Clover to "hotpatch" ACPI

Hello Rehabman, everybody,

I've patched with luck the battery status via hotpatch but I'm still experiencing this weird issue, probably connected with my custom SSDT code:

sometimes, on discharging phase, happend like one plug and immediatly unplug the charger cable while this is not phisically happening... I have the proper sound and also brightness changing of this procedure in that quick moment.

Checked the code many and many times but my knowledge on ACPI patching is limited to your (rehabman) posts.


attatched the requested file,
Thanks really for your work

Different result with static patch?
 
Different result with static patch?

Yes but maybe I kept the static patch for a too short time to observe the syntom.


MacBookPro14,1 would be a better choice

FakeSMC.kext seems to be missing from /Library/Extensions for some reason?


How and where to install kexts:

FakeSMC.kext was missing from /L/E for my ignorance, now thanks to your post and guide the overall system stability get a hugely improvement and other minor issues are also disappered. Still testing the battery status, but fingers cross, seems ok for now.

Thanks both
 
Hi,
i'm trying to create an hotpach for my brightness key. I already applied the code on my DSDT to check if it works and it's ok.

Code:
Method (_Q01, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0405) //DOWN
        }
Method (_Q02, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0406) //UP
        }

If i apply that code directly in the DSDT i can control brightness using my keyboard.
I then have created an hotpatch like this :
Code:
DefinitionBlock ("", "SSDT", 2, "hack", "BRIG", 0x00000000)
{
    External(_SB.PCI0.LPCB.EC, DeviceObj)
    External(_SB.PCI0.LPCB.PS2K, DeviceObj)
    Scope(_SB.PCI0.LPCB.EC)
    {
        Method (_Q01, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0405) //DOWN
        }
        Method (_Q02, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0406) //UP
        }
    }
}
and renamed in Clover _Q01 to XQ01 and _Q02 to XQ02 but it doesn't work.
To check if the problem was the hotpach or the renaming in clover i inserted again the DSDT leaving the hotpatch.aml too.
If the rename was working clover should have renamed _Q01 to XQ01 so the brightness should have not work even if the patched DSDT was there (right ?) but it works.
So i think is the rename not working but i don't know why.

Could someone please help me ?


EDIT : Solved. I was making a mistake in the Method. it should have been just PS2K instead of \_SB.PCI0.LPCB.PS2K
 

Attachments

  • debug_30823.zip
    2.2 MB · Views: 140
Last edited:
Hi,
i'm trying to create an hotpach for my brightness key. I already applied the code on my DSDT to check if it works and it's ok.

Code:
Method (_Q01, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0405) //DOWN
        }
Method (_Q02, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0406) //UP
        }

If i apply that code directly in the DSDT i can control brightness using my keyboard.
I then have created an hotpatch like this :
Code:
DefinitionBlock ("", "SSDT", 2, "hack", "BRIG", 0x00000000)
{
    External(_SB.PCI0.LPCB.EC, DeviceObj)
    External(_SB.PCI0.LPCB.PS2K, DeviceObj)
    Scope(_SB.PCI0.LPCB.EC)
    {
        Method (_Q01, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0405) //DOWN
        }
        Method (_Q02, 0, NotSerialized)  // _Qxx: EC Query
        {
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0406) //UP
        }
    }
}
and renamed in Clover _Q01 to XQ01 and _Q02 to XQ02 but it doesn't work.
To check if the problem was the hotpach or the renaming in clover i inserted again the DSDT leaving the hotpatch.aml too.
If the rename was working clover should have renamed _Q01 to XQ01 so the brightness should have not work even if the patched DSDT was there (right ?) but it works.
So i think is the rename not working but i don't know why.

Could someone please help me ?


EDIT : Solved. I was making a mistake in the Method. it should have been just PS2K instead of \_SB.PCI0.LPCB.PS2K

The problem is your config.plist has no effective rename for _Q01/_Q02.
It is quite evident in your patchmatic -extract output (DSDT.aml).
 
The problem is your config.plist has no effective rename for _Q01/_Q02.
It is quite evident in your patchmatic -extract output (DSDT.aml).
Yes thank you !
 
Hi Rehabman, my battery status not showing, in my DSDT have 2 device BAT is BAT1 and BAT2 : so i want to disable BAT2 to enable Battery status, how ? . Because in DSDT patch im using Disable BAT1, BAT2 patchs . I don't know convert this to hotpatch in clover :(
 
Hi Rehabman,
I have done some work with your post. On my laptop, it seems that most of the functions are working. But I have observed that every time the phone is turned on, some ACPI errors are output on the screen. Can you help me fix these mistakes?
Sorry for my poor English.
Thank you for your great work.
 

Attachments

  • HP-Zhan66-G2(Whiskey Lake).zip
    4 MB · Views: 97
Last edited:
can someone make hot patch for battery
I couldn't make hot patch for battery this is very static patch
I attached required file
 

Attachments

  • Fujitsu.zip
    65 KB · Views: 115
I'm experimenting with CLOVER hotpatches for the first time after manually applying DSDT patches to my first 3 hackintoshes. I found a case where the "standard" CLOVER Darwin OS identification hotpatch is incomplete. In the Dell Latitude E6410 DSDT, there are two places where variable assignments are based on OS identification: Method (OSID) and Method (IINI). The "standard" CLOVER OS identification hotpatch works only for Method (IINI), so a different patch is required for Method (OSID).

Also, there is a bug / coding mistake in the Dell E6410 DSDT (BIOS A17) that renders the hotpatch of Method (IINI) ineffective. I started a thread about this here: https://www.tonymacx86.com/threads/dsdt-aml-question-for-dell-latitude-e6410.279338/

EDIT: I just discovered the XOSI / _OSI override method and suspect that this might be the best way (better than CLOVER hotpatch) to handle _OSI calls in the Dell Latitude E6410 DSDT. Still learning about XOSI and haven't drawn a conclusion.
 
Last edited:
Hello, I tried to hot patch ACPI for working battery status. I followed up the guide and it seemed to work, but unfortunately my battery indicator stays fixed on 100%. I double checked scopes and offset values, but nothing to do. Here are my PR files attached, in case anyone could help me. Thank you all in advance.

PS: I suspect it has something to do with more than one Field() definition on the same Operation Region (ERAM, or, in my SSDT, ERM2), but not sure about how to fix it.

Code:
MBP-di-Ruptpipt-3:~ ruptpipt$ kextstat|grep -y acpiplat
   15    2 0xffffff7f83636000 0x9c000    0x9c000    com.apple.driver.AppleACPIPlatform (6.1) F5A615E4-D5B8-3E06-A29F-F79EA07A15EF <14 13 12 8 7 6 5 3 1>
MBP-di-Ruptpipt-3:~ ruptpipt$ kextstat|grep -y appleintelcpu
MBP-di-Ruptpipt-3:~ ruptpipt$ kextstat|grep -y applelpc
  123    0 0xffffff7f8469f000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 6DD4B940-38F9-3E34-8641-19F57B5FA0A8 <119 13 6 5 3>
MBP-di-Ruptpipt-3:~ ruptpipt$ sudo touch /System/Library/Extensions && sudo kextcache -u /
Warning: /AppleInternal/Library/Extensions: No such file or directory
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb12a5e0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/BrcmPatchRAM2.kext/", ID = "com.no-one.BrcmPatchRAM2" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba78bdb0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/BrcmFirmwareRepo.kext/", ID = "com.no-one.BrcmFirmwareStore" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba78e360 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/FakeSMC.kext/", ID = "org.netkas.driver.FakeSMC" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb014330 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Mouse.kext/", ID = "org.rehabman.voodoo.driver.PS2Mouse" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb008910 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/", ID = "org.rehabman.voodoo.driver.PS2Controller" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb00da30 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Keyboard.kext/", ID = "org.rehabman.voodoo.driver.PS2Keyboard" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb009fb0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Trackpad.kext/", ID = "org.rehabman.voodoo.driver.PS2Trackpad" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba763840 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/AppleBacklightFixup.kext/", ID = "com.hieplpvip.AppleBacklightFixup" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb8507f30 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/Lilu.kext/", ID = "as.vit9696.Lilu" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba67efd0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/USBInjectAll.kext/", ID = "com.rehabman.driver.USBInjectAll" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb007170 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/RealtekRTL8111.kext/", ID = "com.insanelymac.RealtekRTL8111" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb84082a0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/WhateverGreen.kext/", ID = "as.vit9696.WhateverGreen" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb840ab60 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/AppleALC.kext/", ID = "as.vit9696.AppleALC" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb85f8250 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/AirportBrcmFixup.kext/", ID = "as.lvs1974.AirportBrcmFixup" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb85f6aa0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/BT4LEContinuityFixup.kext/", ID = "as.lvs1974.BT4LEContinuityFixup" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba6601d0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/ACPIBatteryManager.kext/", ID = "org.rehabman.driver.AppleSmartBatteryManager" }
KernelCache ID: A03E29BA58F541EF81ADDC21B5D31EFC
MBP-di-Ruptpipt-3:~ ruptpipt$

EDIT: I was wrong. I used wrong offsets in ERM2 OpRegion (I was counting field sizes as bytes instead of bits). Fixed them and all works fine. Thanks (and sorry) everyone for time wasting. If you need stupid mistakes please contact me. :D

Keep in mind that Offset arguments are expressed in bytes, while field sizes are in bits, so:
Code:
Offset(0x04), 
STEF,  8,
AAST,  8,
is
Code:
Offset(0x05),
AAST,  8,
and not
Code:
Offset(0x0c),
AAST, 8,
and you won't waste a day like I did. ;)
 

Attachments

  • CLOVER.zip
    1.6 MB · Views: 152
  • RehabMan.zip
    50.8 KB · Views: 150
Last edited:
Back
Top