Contribute
Register

[Guide] How to patch DSDT for working battery status

I can confirm that: battery_Dell-Inspiron-15-7xxx patch also works on Dell Vostro V5459
 
So I'm almost to the point of having a working battery status. I can look in IORegistryExplorer and I know the reason it doesn't report a percentage is because MaxCapacity and DesignCapacity are returning as 0x0. CurrentCapacity is returning (I don't know for sure that the value is accurate, but after monitoring it, it does get lower when using the battery and it gets higher when the battery charges) a real value, however. My assumption is that the system is trying to divide CurrentCapacity/MaxCapacity to get the percentage, but it can't do that when MaxCapacity is 0x0.

The reporting of whether the laptop is charging/discharging is working correctly, but the percentage remains at 0% because of the error I just described.

I've installed the debug version of ACPIBatteryManager.kext, and in the console I can see that when the method _BIF is called in the DSDT that I'm getting an AE_BAD_PARAMETER error, though I don't quite know why. Are there some registers in the DSDT that I haven't patched, or haven't patched correctly? I fell I'm so close, and I'd appreciate some insight as to why this is happening from someone more experienced than me in ACPI.

I'm also receiving an error, CDDBatteryMonitor says it received a callback, currentPercentage:0.000000. CSSMERR_DL_DATASTORE_DOESNOT_EXIST

Attached is my DSDT, both patched and unmodified, the patch.txt I used to patch it, and a copy of IOReg along with a printout of the console. I've also attached the other things you said I should in the OP, but I don't know if they'll be much use. I'm just trying to cover my bases.

Thanks a ton!
 

Attachments

  • itsAllHereBoss.zip
    3.3 MB · Views: 72
So I'm almost to the point of having a working battery status. I can look in IORegistryExplorer and I know the reason it doesn't report a percentage is because MaxCapacity and DesignCapacity are returning as 0x0. CurrentCapacity is returning (I don't know for sure that the value is accurate, but after monitoring it, it does get lower when using the battery and it gets higher when the battery charges) a real value, however. My assumption is that the system is trying to divide CurrentCapacity/MaxCapacity to get the percentage, but it can't do that when MaxCapacity is 0x0.

The reporting of whether the laptop is charging/discharging is working correctly, but the percentage remains at 0% because of the error I just described.

I've installed the debug version of ACPIBatteryManager.kext, and in the console I can see that when the method _BIF is called in the DSDT that I'm getting an AE_BAD_PARAMETER error, though I don't quite know why. Are there some registers in the DSDT that I haven't patched, or haven't patched correctly? I fell I'm so close, and I'd appreciate some insight as to why this is happening from someone more experienced than me in ACPI.

I'm also receiving an error, CDDBatteryMonitor says it received a callback, currentPercentage:0.000000. CSSMERR_DL_DATASTORE_DOESNOT_EXIST

Attached is my DSDT, both patched and unmodified, the patch.txt I used to patch it, and a copy of IOReg along with a printout of the console. I've also attached the other things you said I should in the OP, but I don't know if they'll be much use. I'm just trying to cover my bases.

Thanks a ton!

Your profile/signature does not indicate any laptop hardware details.
Please fix as per FAQ.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/

Fields B1MA,B1DN are not patched.
The offset for BARH is not 0x46 (6+8 = 0x6+8=0xe).
 
Your profile/signature does not indicate any laptop hardware details.
Please fix as per FAQ.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/

Fields B1MA,B1DN are not patched.
The offset for BARH is not 0x46 (6+8 = 0x6+8=0xe).

Agh, I can't believe I made such a simple mistake. I've edited my profile to list the laptop specifications. After patching the fields I missed that you caught, and correcting the offset error I made, the battery status is now working perfectly.

I've attaced a copy of the working patch and my native DSDT so you can add it to your repository of patches if it looks alright.

The patch is specifically for my Lenovo Yoga 900 13ISK 80mk.

Thank you so much for your help!
 

Attachments

  • DSDT.dsl
    1 MB · Views: 113
  • patch.txt
    6.5 KB · Views: 84
Agh, I can't believe I made such a simple mistake. I've edited my profile to list the laptop specifications. After patching the fields I missed that you caught, and correcting the offset error I made, the battery status is now working perfectly.

I've attaced a copy of the working patch and my native DSDT so you can add it to your repository of patches if it looks alright.

The patch is specifically for my Lenovo Yoga 900 13ISK 80mk.

Thank you so much for your help!

I think you have incorrect offsets for B1MA, B1DN.
These are my calculations... please check against your own:
Code:
                Offset (0x76), 
                B1DC,   16, //76
                B1DV,   16, //78
                BDCW,   16, //7a
                BDCL,   16, //7c
                B1AR,   16, //7e
                B1MA,   64, //80
                B1DN,   64, //88
 
I think you have incorrect offsets for B1MA, B1DN.
These are my calculations... please check against your own:
Code:
                Offset (0x76),
                B1DC,   16, //76
                B1DV,   16, //78
                BDCW,   16, //7a
                BDCL,   16, //7c
                B1AR,   16, //7e
                B1MA,   64, //80
                B1DN,   64, //88

Your numbers are correct, I think I accidentally counted two too few bytes when adding them all together.

I've uploaded the updated patch.
 

Attachments

  • batteryPatch.txt
    6.5 KB · Views: 117
Your numbers are correct, I think I accidentally counted two too few bytes when adding them all together.

I've uploaded the updated patch.

I think the offset is wrong for SMD0 as well.
I will fix when I add it to github.
 
I think the offset is wrong for SMD0 as well.
I will fix when I add it to github.

Sounds good. I'm sorry that the offsets are off. The patch works regardless, but I understand it's important to make sure everything is correct in order to avoid potential bugs later.

Thanks again for a great tutorial, I would never have been able to do this without your help!
 
Sounds good. I'm sorry that the offsets are off. The patch works regardless, but I understand it's important to make sure everything is correct in order to avoid potential bugs later.

Thanks again for a great tutorial, I would never have been able to do this without your help!

Added the patch to github. Please test from repo. Thanks!
 
Back
Top