Contribute
Register

[Guide] How to patch DSDT for working battery status

The offset of any EC register is the offset of the previous register + size or offset specified in an immediately prior Offset directive.
Hi RehabMan - I have changed my patch. I have removed the code that utilizes offsets (since I cannot figure out how to correctly calculate them) and have replaced it with the "long way", meaning I extrapolated how the 16 and 32 bit fields are managed and used that method instead. Could you take a quick look?

I have patched my DSDT with this to test it out, but I have a compiling error that I am not sure how to resolve. The error is:

14544 6126 syntax error, unexpected PARSEOP_SCOPE, expecting $end and premature End-Of-File

This in relation to the I2C patches I am also applying as line 14544 is:

Scope (_SB.PCI0.I2C1)

I have been researching the error and it seems it may be a missing "{" or "}" somewhere. Any suggestions? Thanks!
 

Attachments

  • Archive 2.zip
    5.2 MB · Views: 63
Last edited:
I apologize, while I understand it is just adding numbers, with the conversion of bytes, bits, and hex, I do not know how to do this. In my DSDT file, the values (in red) where I need to calculate the offsets are:

Offset (0x1C),
BRC0, 16,
BTP0, 16,
BCC0, 16,
BCV0, 16,
BME0, 16,
FCC0, 16,
BDC0, 16,
BDV0, 16,
BMD0, 16,
BSN0, 16,
MANA, 96,

Offset (0x8B),
TSHT, 8,
DENA, 64,
CHEM, 32,
BAAC, 16,
RTE0, 16,
ATE0, 16,
ATF0, 16,
FWIN, 64,
BARC, 128,

Simple math... for example:

Offset (0x1C),
BRC0, 16, //1c
BTP0, 16, //1e
BCC0, 16, //20
BCV0, 16, //22
BME0, 16,//24
FCC0, 16,//26
BDC0, 16,//28
BDV0, 16,//2a
BMD0, 16,//2c
BSN0, 16,//2e
MANA, 96,//30
 
Thanks for your time, i went through the whole patch process again, and still no luck. Can you take a lookt at it one more time?

No ioreg in debug zip. Please check your files before upload.
 
hello,RehabMan,This is my ioreg. I can't find the relevant content according to your posts. Is there any way to solve the problem of power display?
sorry,is Battery status display,I don't find "EmbeddedControl", so I put the battery driver on L/E, but battery status is 100%. no change.connection charger already shows "Use the battery". Is there any way? My files are at #4985
Your kextcache output proves kexts are not installed correctly.
All kexts you need must be installed to the system volume.
Read post #2 of the Clover guide for details:
 
Use debug ACPIBatteryManager.kext, analyze related kernel logs.
Keep in mind older versions of ACPIBatteryManager.kext use a different technique to detect AC status (worth trying).
Since my original post, I have resolved all but the last issue listed, for which I have opened a separate thread here.
As recommended, I have tried using the debug version of ACPIBatteryManager.kext, but have been unable to determine anything from the logs. PR files attached. Could you take a look please?
 

Attachments

  • debug_14468.zip
    1.9 MB · Views: 57
No ioreg in debug zip. Please check your files before upload.
Sorry, just noticed gen_debug script can not generate a ioreg file for me, it shows "
IOREG dump has failed 3 times. Dumping generic IOREG report instead.", i included an ioreg file manually, hope it's fine.
 

Attachments

  • debug_7641.zip
    3 MB · Views: 72
  • DSDT-common-patches-noFixMutex-noAddImei.dsl
    430.6 KB · Views: 69
  • patch.txt
    11.3 KB · Views: 72
  • DSDT-original.dsl
    431.1 KB · Views: 65
Your kextcache output proves kexts are not installed correctly.
All kexts you need must be installed to the system volume.
Read post #2 of the Clover guide for details:
Thank you for your reminder, I have followed the guidelines to properly install kext, this is my new file, please help me again.
 

Attachments

  • debug_19483.zip
    1.5 MB · Views: 68
Since my original post, I have resolved all but the last issue listed, for which I have opened a separate thread here.
As recommended, I have tried using the debug version of ACPIBatteryManager.kext, but have been unable to determine anything from the logs. PR files attached. Could you take a look please?

I replied in your other thread. No need to address same issue from two different threads.
 
Sorry, just noticed gen_debug script can not generate a ioreg file for me, it shows "
IOREG dump has failed 3 times. Dumping generic IOREG report instead.", i included an ioreg file manually, hope it's fine.

You can see that MaxCapacity/CurrentCapacity are nonsense.
Something is wrong with your _BIF/_BST methods or your patching.
Use debug ACPIBatteryManager.kext to further diagnose/debug.
 
Thank you for your reminder, I have followed the guidelines to properly install kext, this is my new file, please help me again.

Use debug ACPIBatteryManager.kext to get detailed kernel logs related to battery methods.
Then diagnose/debug from there.
 
Back
Top