Contribute
Register

[Guide] How to patch DSDT for working battery status

For the code above, we want to translate it to:
Code:
   Store (B1B2(DC00,DC01), Index (DerefOf (Index (Local0, 0x02)), Zero))
   Store (ShiftRight (B1B2(DC00,DC01), 0x08), Index (DerefOf (Index (Local0, 0x02)), One))
A patch can be constructed to automate this, and as you will see patches for other 16-bit fields follow this same pattern:
Code:
into method label GBTI code_regex \(BDC0, replaceall_matched begin (B1B2(DC00,DC01), end;
An astute reader will note that this code could be optimized:
Code:
   Store (DC00, Index (DerefOf (Index (Local0, 0x02)), Zero))
   Store (DC01, Index (DerefOf (Index (Local0, 0x02)), One))
Why not below?
Code:
   Store (DC00, Index (DerefOf (Index (Local0, 0x02)), One))
   Store (DC01, Index (DerefOf (Index (Local0, 0x02)), Zero))
 
I fixed the obvious errors in the patch, but after that, there were still 8 errors where the patch did not change the objects to the replacement values that I defined in the patch. I do not know why the patch did not perform these 8 replacements. I was able to manually edit these 8 values in the DSDT.dsl file and then successfully compile the new/patched DSDT.aml.

While I feel this is a success and I have my battery status working now (thank you again for your help), I would like to understand why the patch did not change the 8 objects. To that end, I have attached revised troubleshooting files, as well as a list of the errors (DSDT with patch compile errors.png), and the final patched DSDT with manual corrections. If you could help me with this understanding, I am hoping to change the patch to catch these last 8 values, and then the patch should be good for you to add to your repository for this laptop model.

Super obvious...

Example code not patched:
If (FCC0)

Your patch is looking for: (FCC0,
Code:
into method label _BIF code_regex \(FCC0, replaceall_matched begin (B1B2(CC01,CC02), end;

But '(FCC0)' is not the same as '(FCC0,'
 
Hello @RehabMan
I can confirm that the battery patch is working for my laptop (MSI GP62 2QE). I guess the topic is the best place to post such kind of report. Please expand the compatibility description.

Thanks. Will add a compatibility comment for 'MSI GP62 2QE'
 
For the code above, we want to translate it to:
Code:
   Store (B1B2(DC00,DC01), Index (DerefOf (Index (Local0, 0x02)), Zero))
   Store (ShiftRight (B1B2(DC00,DC01), 0x08), Index (DerefOf (Index (Local0, 0x02)), One))
A patch can be constructed to automate this, and as you will see patches for other 16-bit fields follow this same pattern:
Code:
into method label GBTI code_regex \(BDC0, replaceall_matched begin (B1B2(DC00,DC01), end;
An astute reader will note that this code could be optimized:
Code:
   Store (DC00, Index (DerefOf (Index (Local0, 0x02)), Zero))
   Store (DC01, Index (DerefOf (Index (Local0, 0x02)), One))
Why not below?
Code:
   Store (DC00, Index (DerefOf (Index (Local0, 0x02)), One))
   Store (DC01, Index (DerefOf (Index (Local0, 0x02)), Zero))

EC registers are in Intel byte order.
 
Yes, you're right about the description of the behaviour. And your system specs is almost the same with mine. I'd send you a message so we don't go off-topic.
Edit: Oops! Seems like the messaging feature is broken at the moment.
Meydon, I have the same laptop as you I am attempting to complete the build. The HP-Omen AX250WM, Anychance You could post your build with your EFI folder? I attempted to message you but it says I need 75 posts before I can do that.
 
See notes in "HP G6 2221ss" patch regarding INIT/ACEL.

Hi, RehabMan. I can confirm the "HP G6 2221ss" patch works for HP Omen 15-ax250wm (only when the commented INIT/ACEL line is uncommented). Please add compatibility for the patch. I've attached my vanilla decompiled dsdt.dsl file if you'll like to confirm.
 

Attachments

  • DSDT.dsl
    962.7 KB · Views: 101
Meydon, I have the same laptop as you I am attempting to complete the build. The HP-Omen AX250WM, Anychance You could post your build with your EFI folder? I attempted to message you but it says I need 75 posts before I can do that.
Hi excelon, my build is mostly what's specified here, except I have an NVMe SSD (250GB) in addition to the 1TB SATA HDD (which I've swapped for an SSD). I'm attaching the most relevant parts of my EFI/CLOVER folder. I followed RehabMan's CLOVER guide and all (I think?) my patches are available on RehabMan's laptop patch repo. Almost everything is working, except HDMI (still testing, might be due to my SMBIOS) and Wi-Fi (I'm awaiting a Broadcom chip). Also, I'm dual-booting with Windows (if that matters).

Concerning messaging, I'm aware of the issue and I can't message you either. I would say you open a new support thread where you can get things solved and we can communicate. Also, that would prevent highjacking this thread and going off-topic.
 

Attachments

  • efi_clover.zip
    1 MB · Views: 185
You are a life saver! I’ve got a NVME as well and that’s where OSX is installed, I’ve followed rehabmans instructions for every one of my machines including this one, however this whole SSDT and DSDT patching thing is litererally the most confusing portion I’ve ever had to go through. Thank you so much for your help!
 
I created a new thread in the guides section for you to post your files. Thanks again!

 
Hi, RehabMan. I can confirm the "HP G6 2221ss" patch works for HP Omen 15-ax250wm (only when the commented INIT/ACEL line is uncommented). Please add compatibility for the patch. I've attached my vanilla decompiled dsdt.dsl file if you'll like to confirm.

I will add a comment to that effect. Thanks.
 
Back
Top