Jump to content

AppleACPIBatteryManager/AppleSmartBatteryManager For Lion


Zprood
 Share

182 posts in this topic

Recommended Posts

Zprood,

Thank you for all the work you have done on this. I am having real difficulty trying to identify exactly how to modify my DSDT for this. The machine is a lenovo G570.

I'd really appreciate it if you could take a look.

Many thanks for your time.

Try this one:dsdt_fix.aml.zip

Link to comment
Share on other sites

Working perfectly on Gateway NV57H (i5/2410m) !

 

The 8 bit variable conversion routines simplify it all down to little more than a basic search & replace op.

VoodooBattery lives again ;)

 

Well done !!!

Link to comment
Share on other sites

Hey,

 

i have a Lenovo Thinkpad W520 and i think everything works fine (without DSDT edit...) but i don't get a cycle count. Any idea? I have tried the DSDT edit but i can't find some of the stuff i have to edit / add.

 

bildschirmfoto20111210uh.png

 

 

Hope someone can help me here a little bit. Thanks!

dsdt.aml.zip

Link to comment
Share on other sites

  • 3 weeks later...

Zprood,

 

I try to integrate your fix in my DSDT, but didn't find the right point

to replace 16 bit to 8 bit with your method in my HP/Compaq

DSDT. Tried it several times, but was not able to compile it.

Maybe you (or someone else) can point me to the right direction.

Thanks.

 

Regards,

 

Sebastian

 

DSDT.aml.zip

Link to comment
Share on other sites

Zprood,

 

I try again to fix my DSDT and now I was able to integrate your fix and

compile DSDT with no errors :) . I can now use good old VoodooBattery

with Lion ACPIPlatform kext instead of SL ones to get battery status.

 

Thanks for providing and sharing such a solution. I attached my fixed DSDT,

maybe helpful for someone.

 

Happy new year,

 

Sebastian

 

DSDT_b1b2.aml.zip

Link to comment
Share on other sites

Hi, I have a Toshiba Laptop which works great with Snow and Lion ; The DSDT is fixed for almost everything working like usb,sleep,hpet,lpc and so on and tested over months usage with no problems; OSX works problem-free with SMBIOS of MacBookPro5.1 ( Core2Duo Speedstep vanilla ) but this Battery Thing with Lion is the last open issue for me. My BAT1 Entries in DSDT look very different from your example code and I don't want to mess my otherwise working file.

 

Can you figure out what I need to change in order to have working battery kexts in Lion with original apple acpi and pci kexts ( I don't want to mix Snow and Lion files ).

 

Thanks :king:

 

The complete dsdt that I use in OSX is attached as file.

 

Here only Battery section :

 

Device (BAT1)

{

Name (_HID, EisaId ("PNP0C0A"))

Name (_UID, One)

Name (_PCL, Package (0x01)

{

_SB

})

Name (BMDL, Zero)

Method (_STA, 0, NotSerialized)

{

If (ECOK ())

{

If (^^EC0.BAL0)

{

Sleep (0x14)

Return (0x1F)

}

Else

{

Sleep (0x14)

Return (0x0F)

}

}

Else

{

Sleep (0x14)

Return (0x1F)

}

}

 

 

 

 

 

Method (_BIF, 0, NotSerialized)

{

Name (STAT, Package (0x0D)

{

One,

0x1770,

0x1770,

One,

0x2A30,

0x0258,

0xB4,

0x0108,

0x0EC4,

"PA3533U ",

"41167",

"Li-Ion",

"TOSHIBA"

})

Name (CMMA, Buffer (0x0C) {})

CreateByteField (CMMA, Zero, APN1)

CreateByteField (CMMA, One, APN2)

CreateByteField (CMMA, 0x02, APN3)

CreateByteField (CMMA, 0x03, APN4)

CreateByteField (CMMA, 0x04, APN5)

CreateByteField (CMMA, 0x05, APN6)

CreateByteField (CMMA, 0x06, APN7)

CreateByteField (CMMA, 0x07, APN8)

CreateByteField (CMMA, 0x08, APN9)

CreateByteField (CMMA, 0x09, Z00A)

CreateByteField (CMMA, 0x0A, Z00B)

CreateByteField (CMMA, 0x0B, Z00C)

Store (PHMR (0xACF8), APN1)

Store (PHMR (0xADF8), APN2)

Store (PHMR (0xAEF8), APN3)

Store (PHMR (0xAFF8), APN4)

Store (PHMR (0xB0F8), APN5)

Store (PHMR (0xB1F8), APN6)

Store (PHMR (0xB2F8), APN7)

Store (PHMR (0xB3F8), APN8)

Store (PHMR (0xB4F8), APN9)

Store (PHMR (0xB5F8), Z00A)

Store (PHMR (0xB6F8), Z00B)

Store (PHMR (0xB7F8), Z00C)

Store (CMMA, Index (STAT, 0x09))

If (ECOK ())

{

Store (^^EC0.BDN0, Local0)

Store (Local0, BMDL)

Store (^^EC0.BFC0, BFC1)

Sleep (0x14)

Store (^^EC0.BDC0, Index (STAT, One))

Sleep (0x14)

Store (^^EC0.BDV0, Index (STAT, 0x04))

Sleep (0x14)

}

Else

{

Store ("Li-Ion", Index (STAT, 0x0B))

Store (BFC1, Index (STAT, One))

}

 

If (BFC1)

{

Divide (BFC1, 0x64, Local0, Local1)

Multiply (Local1, 0x0A, Local1)

Store (Local1, Index (STAT, 0x05))

Divide (BFC1, 0x64, Local0, Local1)

Multiply (Local1, 0x03, Local1)

Store (Local1, Index (STAT, 0x06))

Store (BFC1, Index (STAT, 0x02))

}

 

Return (STAT)

}

 

Method (_BST, 0, NotSerialized)

{

Name (PBST, Package (0x04)

{

Zero,

0xFFFFFFFF,

0xFFFFFFFF,

0x2A30

})

Store (0x2A30, Local3)

If (ECOK ())

{

Sleep (0x14)

Store (^^EC0.BST0, BST1)

Sleep (0x14)

Store (^^EC0.BRC0, Local2)

Sleep (0x14)

Store (^^EC0.BPV0, Local3)

Sleep (0x14)

}

 

Store (BST1, Index (PBST, Zero))

Store (Zero, Index (PBST, One))

Store (Local2, Index (PBST, 0x02))

Store (Local3, Index (PBST, 0x03))

If (ECOK ())

{

If (LNotEqual (^^EC0.BDN0, BMDL))

{

Notify (BAT1, 0x81)

}

}

 

Return (PBST)

}

}

 

Device (DMAC)

{

Name (_HID, EisaId ("PNP0200"))

Name (_CRS, ResourceTemplate ()

{

IO (Decode16,

0x0000, // Range Minimum

0x0000, // Range Maximum

0x01, // Alignment

0x20, // Length

)

IO (Decode16,

0x0081, // Range Minimum

0x0081, // Range Maximum

0x01, // Alignment

0x11, // Length

)

IO (Decode16,

0x0093, // Range Minimum

0x0093, // Range Maximum

0x01, // Alignment

0x0D, // Length

)

IO (Decode16,

0x00C0, // Range Minimum

0x00C0, // Range Maximum

0x01, // Alignment

0x20, // Length

)

DMA (Compatibility, NotBusMaster, Transfer8_16, )

{4}

})

}

dsdt.aml.zip

Link to comment
Share on other sites

  • 2 weeks later...

 

I created a complete dsl instruction file of all the edits I did to get SmartBatteryManager working on Lion for my Asus M60J, but should be applicable to all the Asus Core i3/i5/i7 notebooks. From what I've seen so far, all the Asus Core i notebooks have identical battery dsdt.

 

The Lion dsdt edits instruction file is at the bottom of my post# 95 in glsy's thread under the name Asus_Coreix_Lion_Edits. I have also included a full dsdt of my Asus M60J on Lion in case they don't understand a particular instruction.

 

http://www.insanelym...dpost&p=1771830

 

Thanks for the instructions buddy, working battery here at last :)

 

Cheers

Link to comment
Share on other sites

  • 2 weeks later...

First Of All, Thanks these people for the battery driver:Chun-Nan, zenglg1977, gsly, bcc9, VIVXIX, weizh126. Cause without what they do can't get it work.Now start the topic.

 

Since apple changes some things on lion, the Appleacpibatterymanager does't work any more under the Lion, so people use roll backed next to get is work, but this has shortage. At the first, bcc9 found that lion reads battery info from EC by 8bit, and most laptop's EC region use 16bit to store battery information, so the legacy driver doesn't work include voodoo battery. This information is important for next.

 

The guy zenglg1977 takes some time to rewrite the sources code of Appleacpibatterymanager to make it work for lion. It is needed to edit the code of battery in the dsdt, so divide 16bit register into two 8bit can make sense. Like:

Before
//
Field (RAM, ByteAcc, Lock, Preserve)
	{
				Offset (0xE0),
		BSDC,   16,
		BSDV,   16,
		BSSN,   16
	}
//
Later
//
Field (RAM, ByteAcc, Lock, Preserve)
	{
				Offset (0xE0),
		SDC0,   8,
		SDC1,   8,
		SDV0,   8,
		SDV1,   8,
		SSN0,   8,
		SSN1,   8
	}
//

then, the transmit part can be done like this:

For example:

 

Before:
Multiply (BSDC, 0x0A, Local1)

Later:
Multiply (SDC1, 0x100, Local1)
Add (SDC0, Local1, Local1)
Multiply (Local1, 0x0A, Local1)

Before:
Store (BSDC, Local1)

Later:
Multiply (SDC1, 0x100, Local1)
Add (SDC0, Local1, Local1)

 

This way created by zenglg1977, after done with this can make it work.

But when compare VIVXIX with others method, i found his method is simple and easy to reach, it named "B1B2".

Here is his method:

1, create the "Method (B1B2, 2, NotSerialized)" as global:

Method (B1B2, 2, NotSerialized)
  {
	Or (ShiftLeft(Arg1,0x08), Arg0, Local0)
	Return (Local0)
} //for 16bit

  Method (B1B4, 4, NotSerialized)	
 {
	Or (ShiftLeft(Arg1,0x08), Arg0, Local0)
	Or (ShiftLeft(Arg2,0x10), Local0, Local0)
	Or (ShiftLeft(Arg3,0x18), Local0, Local0)
	Return (Local0)
  } //for 32bit

  Method (L1L4, 4, NotSerialized)//32*4=128
 {
	Or (ShiftLeft(Arg1,0x20), Arg0, Local0)
	Or (ShiftLeft(Arg2,0x40), Local0, Local0)
	Or (ShiftLeft(Arg3,0x60), Local0, Local0)
	Return (Local0)
  }//for 128bit

 

2, change the 16bit register into two 8bit register, like:

		 //BPV0,  
 SPV0,   8,
 SPV1,   8,

3, here is some collections of example editing work he finished before.

A:

//Store (^^EC0.BAC0, Local5)
  Store (B1B2(^^EC0.SAC0,^^EC0.SAC1), Local5)

 

B:

//Store (^^EC0.BDC0, Index (STAT, One))
  Store (B1B2(^^EC0.SDC0,^^EC0.SDC1), Index (STAT, One))

 

C:

//Multiply (BGU1, BFC1 ,Local2)
  Multiply (BGU1, B1B2 (BFC0, BFC1), Local2)

 

Some special parts as below:

D:

//If (^^EC0.BDC0 )
  If (B1B2(^^EC0.SDC0,^^EC0.SDC1))

 

E:

//If (LGreater (^^EC0.BAC0, 0xFB00))
  If (LGreater (B1B2(^^EC0.SAC0,^^EC0.SAC1), 0xFB00)

 

F:

//Store (^^EC0.BDC0, BFC1)  
  Store (^^EC0.SDC1, BFC1)
  Sleep (0x14)
  Store (^^EC0.SDC0, BFC0)

 

More about the sources code, zenglg1977 combines gsly's AppleSmartBatteryManger code into whole project, then people get two choice. And weizh126 plays a trick about battery cycle count in the _BIF method part, the _BIF just contains 13 items in the package and he adds "Zero" to it become 14, and store the cycle count register info in it, it sounds illegal, but it works.

 

Last, here is the sources code and attachments.

 

AppleBatteryManager_src.zip

AppleACPIBatteryManager.kext.zip

AppleSmartBatteryManager.kext.zip

 

Also screenshots:

Screen_Shot_2011_11_21_at_12.41.24_AM.png

Screen_Shot_2011_11_21_at_12.41.47_AM.png

 

Original link address:

http://bbs.pcbeta.co...935509-1-1.html

http://bbs.pcbeta.co...935582-1-1.html

 

 

 

 

Hello Zprood,

 

I am having trouble getting the patch to the battery and the LID,

can you help me?

I attach dsdt

dsdt.aml.zip

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 3 weeks later...
  • 2 weeks later...

Try this one:dsdt_fix.aml.zip

 

@Zprood

 

i have successfully edited my DSDT, converted registers to 8 bit, battery is being detected, but not properly.

i have attached screenshots and my dsdt.

 

Problem is that i am getting

1. Charge Remaining wrong figures

2. Amperes remaining in -ve figures

3. Battery at 20:00 remaining at full charge.

 

Please help me to rectify these errors.

 

Thanks in advance.

post-902922-0-38032300-1333301326_thumb.png

post-902922-0-40464600-1333301332_thumb.png

post-902922-0-77809300-1333301342_thumb.png

DSDTx.aml.zip

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

I have a Lenovo Ideapad Y560 i7. I tried to apply this battery patch to my dsdt but it looks different thank the one in the example. Could someone please take a look and help me?

Thank you!

dsdt.zip

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...