Contribute
Register

[Guide] How to patch DSDT for working battery status

RehabMan

Moderator
Joined
May 2, 2012
Messages
184,100
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
How to patch DSDT for working battery status

I still can confirm that after sleep and wake i've got the right battery status on my particular configuration in my signature. Also i use clover installation method. Please see my screenshot after wake from sleep. The sleep initiated on lid close.

My reply was regarding your USB question.
 
Joined
Jul 10, 2012
Messages
4
Motherboard
Mac OS 10.9.4
CPU
Intel core i5 u4200
Graphics
intel HD 4400
Mac
Classic Mac
Mobile Phone
How to patch DSDT for working battery status

I tried to patch using your GUIDE but there is a strange problem: If I use power line or battery alone, the status shows OK, but If I use power line and battery charged at 100%, the status is incorrect that I used battery but the power doesn't drop down at 99%. Here is my DSDT using your battery patch. Thank you for your interest Rehabman.
 

Attachments

  • DSDT.aml
    89.2 KB · Views: 70

RehabMan

Moderator
Joined
May 2, 2012
Messages
184,100
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
How to patch DSDT for working battery status

I tried to patch using your GUIDE but there is a strange problem: If I use power line or battery alone, the status shows OK, but If I use power line and battery charged at 100%, the status is incorrect that I used battery but the power doesn't drop down at 99%. Here is my DSDT using your battery patch. Thank you for your interest Rehabman.

What is the laptop model? What version of OS X? Which patch did you apply? Your DSDT does not appear to be patched correctly (BDAT, BDA2).
 

RehabMan

Moderator
Joined
May 2, 2012
Messages
184,100
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
How to patch DSDT for working battery status

My laptop is Asus Pro 401LA, Mac OS 10.9.4, I used your repository
https://github.com/RehabMan/Laptop-DSDT-Patch

Which patch? There are many.

Please provide complete details in your profile/signature
(Profile/Settings link in upper right corner of this site)

System: manufacturer/model
CPU: detailed CPU model + motherboard chipset
Graphics: all graphics devices + laptop internal screen resolution

For example, typical Ivy laptop:
System: HP ProBook 4540s
CPU: i5-3320m/HM76
Graphics: HD4000, 1366x768

Use CPU-Z on Windows to find CPU (Core iX-xxx) and motherboard chipset (HMxx). For a laptop, these details are important and affect critical installation procedures.
 
Joined
Jun 26, 2013
Messages
49
Motherboard
Asus Prime X299 Deluxe
CPU
Core i7-7800X
Graphics
Nvidia GTX770
Mac
  1. MacBook Pro
Mobile Phone
  1. iOS
How to patch DSDT for working battery status

Thank you, ACPIDebug is really helpful :D

Yes, it turned out that UPBS was buggy, and here is a patch to correct it's implementation.

It works for HP Pavilion dv6-3165sf and It should work for other dv models who have a similar problem (remaining time miscalculation)

Credits for gsly from Insanelymac for the correct implementation.

Code:
into method label UPBS remove_entry;
into device label BAT0 insert
begin
Method (UPBS, 0, NotSerialized)\n
{\n
    Store (^^PCI0.LPCB.EC0.MBST, Index (PBST, Zero))\n
    ^^PCI0.LPCB.EC0.SMRD (0x09, 0x16, 0x0A, RefOf (Local0))\n
    Store (Local0, Index (PBST, One))\n
    ^^PCI0.LPCB.EC0.SMRD (0x09, 0x16, 0x0F, RefOf (Local1))\n
    Store (Local1, Index (PBST, 0x02))\n
    ^^PCI0.LPCB.EC0.SMRD (0x09, 0x16, 0x09, RefOf (Local2))\n
    Store (Local2, Index (PBST, 0x03))\n
}\n
end;

hi, i apply the patch for the dv6-3165sf in my hp dv5-1030el
in maciasl to fix the compiler error I replace the UPBS with this

(I remove the 'B' from LPCB, example PCI0.LPCB.EC0.SMRD --> PCI0.LPC.EC0.SMRD)

Code:
into method label UPBS remove_entry;
into device label BAT0 insert
begin
Method (UPBS, 0, NotSerialized)\n
{\n
    Store (^^PCI0.LPC.EC0.MBST, Index (PBST, Zero))\n
    ^^PCI0.LPC.EC0.SMRD (0x09, 0x16, 0x0A, RefOf (Local0))\n
    Store (Local0, Index (PBST, One))\n
    ^^PCI0.LPC.EC0.SMRD (0x09, 0x16, 0x0F, RefOf (Local1))\n
    Store (Local1, Index (PBST, 0x02))\n
    ^^PCI0.LPC.EC0.SMRD (0x09, 0x16, 0x09, RefOf (Local2))\n
    Store (Local2, Index (PBST, 0x03))\n
}\n
end;

now the battery remaining time seems to be ok
 
Joined
Oct 9, 2013
Messages
8
Motherboard
ASUS X401A-WX108
CPU
Core i3-2350M
Graphics
Intel HD Graphics 3000
Mac
  1. MacBook Pro
Classic Mac
Mobile Phone
How to patch DSDT for working battery status

Great guide RehabMan! My problem is: SMD0, 264, //Offset (??)
OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
Field (ERAM, ByteAcc, NoLock, Preserve)
{
Offset (0x18),
SMPR, 8, //18
SMST, 8,
SMAD, 8,
SMCM, 8,
SMD0, 264, //??
SMAA, 8,

I read “ The offset of any given item is the offset of the prior item + prior item size in bytes, unless an Offset directive is used to change the effective offset” but i don’t understand because my english not good. Can you help me? Thank you very much!
 

RehabMan

Moderator
Joined
May 2, 2012
Messages
184,100
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
How to patch DSDT for working battery status

hi, i apply the patch for the dv6-3165sf in my hp dv5-1030el
in maciasl to fix the compiler error I replace the UPBS with this

(I remove the 'B' from LPCB, example PCI0.LPCB.EC0.SMRD --> PCI0.LPC.EC0.SMRD)

Code:
into method label UPBS remove_entry;
into device label BAT0 insert
begin
Method (UPBS, 0, NotSerialized)\n
{\n
    Store (^^PCI0.LPC.EC0.MBST, Index (PBST, Zero))\n
    ^^PCI0.LPC.EC0.SMRD (0x09, 0x16, 0x0A, RefOf (Local0))\n
    Store (Local0, Index (PBST, One))\n
    ^^PCI0.LPC.EC0.SMRD (0x09, 0x16, 0x0F, RefOf (Local1))\n
    Store (Local1, Index (PBST, 0x02))\n
    ^^PCI0.LPC.EC0.SMRD (0x09, 0x16, 0x09, RefOf (Local2))\n
    Store (Local2, Index (PBST, 0x03))\n
}\n
end;

now the battery remaining time seems to be ok

It would probably make more sense to rename LPC -> LPCB (Macs use LPCB).

Post your DSDT if you want me to look at the possibility of doing that in the patch repo.
 
Top