We need some DSDT patching and kexts. Guide can be found here

http://www.insanelym...pic=272459&st=0Here is original code

<pre class='_prettyXprint _lang-auto _linenums:0'>Field (ECR, ByteAcc, Lock, Preserve)
{
Offset (0x18),
SPTR, 8,
SSTS, 8,
SADR, 8,
SCMD, 8,
SBFR, 256,
SCNT, 8,
Offset (0x80),
B1EX, 1,
, 1,
ACEX, 1,
Offset (0x81),
SWBE, 1,
DCBE, 1,
Offset (0x82),
WLST, 1,
OPST, 1,
Offset (0x83),
LIDS, 1,
Offset (0x84),
B1ST, 8,
Offset (0x86),
BRIT, 8,
Offset (0x93),
LUXH, 8,
LUXL, 8,
Offset (0xA0),
B1RP, 16,
B1RA, 16,
B1PR, 16,
B1VO, 16,
Offset (0xB0),
B1DA, 16,
B1DF, 16,
B1DV, 16,
B1DL, 16,
Offset (0xC0),
CTMP, 8,
Offset (0xC7),
TIST, 8,
Offset (0xD0),
B1TI, 16,
B1SE, 16,
B1CR, 16,
B1TM, 16
}
Device (BAT1)
{
Name (_HID, EisaId ("PNP0C0A"))
Name (_UID, One)
Name (BATI, Package (0x0D)
{
One,
0xFFFFFFFF,
0xFFFFFFFF,
One,
0xFFFFFFFF,
0x03,
0x0A,
One,
One,
"Unknown",
"Unknown",
"Unknown",
"Unknown"
})
Method (_BIF, 0, NotSerialized)
{
If (LEqual (ECON, Zero))
{
Store (SECW (0x82, 0xB0, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, One))
}
Else
{
Store (Local0, Index (BATI, One))
}
Store (SECW (0x82, 0xB2, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x02))
}
Else
{
Store (Local0, Index (BATI, 0x02))
}
Store (SECW (0x82, 0xB4, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x04))
}
Else
{
Store (Local0, Index (BATI, 0x04))
}
Store (Zero, Index (BATI, 0x05))
Store (SECW (0x82, 0xB6, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (Zero, Index (BATI, 0x06))
}
Else
{
Store (Local0, Index (BATI, 0x06))
}
}
Else
{
Store (B1DA, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, One))
}
Else
{
Store (Local0, Index (BATI, One))
}
Store (B1DF, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x02))
}
Else
{
Store (Local0, Index (BATI, 0x02))
}
Store (B1DV, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x04))
}
Else
{
Store (Local0, Index (BATI, 0x04))
}
Store (Zero, Index (BATI, 0x05))
Store (B1DL, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x06))
}
Else
{
Store (Local0, Index (BATI, 0x06))
}
}
Store ("", Index (BATI, 0x09))
Store ("", Index (BATI, 0x0A))
Store ("LION", Index (BATI, 0x0B))
Store ("SAMSUNG Electronics", Index (BATI, 0x0C))
Return (BATI)
}
Name (STAT, Package (0x04)
{
Zero,
Zero,
Zero,
Zero
})
Method (_BST, 0, NotSerialized)
{
If (LEqual (ECON, Zero))
{
Store (SECB (0x81, 0x84), Local0)
If (LAnd (LNotEqual (Local0, Zero), LNotEqual (Local0, 0x05)))
{
If (LEqual (PWRS, One))
{
Store (0x02, Local0)
}
Else
{
Store (One, Local0)
}
}
Store (Local0, Index (STAT, Zero))
Store (SECW (0x82, 0xA4, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, One))
}
Else
{
If (LGreaterEqual (Local0, 0x8000))
{
XOr (Local0, 0xFFFF, Local0)
Increment (Local0)
}
Store (Local0, Index (STAT, One))
}
Store (SECW (0x82, 0xA2, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, 0x02))
}
Else
{
Store (Local0, Index (STAT, 0x02))
}
Store (SECW (0x82, 0xA6, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, 0x03))
}
Else
{
Store (Local0, Index (STAT, 0x03))
}
}
Else
{
Store (B1ST, Local0)
If (LAnd (LNotEqual (Local0, Zero), LNotEqual (Local0, 0x05)))
{
If (LEqual (PWRS, One))
{
Store (0x02, Local0)
}
Else
{
Store (One, Local0)
}
}
Store (Local0, Index (STAT, Zero))
Store (B1PR, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, One))
}
Else
{
If (LGreaterEqual (Local0, 0x8000))
{
XOr (Local0, 0xFFFF, Local0)
Increment (Local0)
}
Store (Local0, Index (STAT, One))
}
Store (B1RA, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, 0x02))
}
Else
{
Store (Local0, Index (STAT, 0x02))
}
Store (B1VO, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, 0x03))
}
Else
{
Store (Local0, Index (STAT, 0x03))
}
}
Return (STAT)
}
Method (_STA, 0, NotSerialized)
{
If (LEqual (ECON, Zero))
{
If (LEqual (SECB (0x85, Zero), One))
{
Store (0x1F, Local0)
}
Else
{
Store (0x0F, Local0)
}
}
Else
{
If (LEqual (B1EX, One))
{
Store (0x1F, Local0)
}
Else
{
Store (0x0F, Local0)
}
}
Return (Local0)
}
Method (_PCL, 0, NotSerialized)
{
Return (_SB)
}
}</pre>

We need to patch _BIF and _BST methods. As you can see they use 16-bit registers which we need to divide in to two 8-bit registers. For example

B1DA, 16
becomes
SDA0, 8,
SDA1, 8

We also need to change the way this registers are stored. Luckily, it's very simple because every register is stored using identical code. For example

Store (B1DA, Local0)
ShiftLeft (Local0, 0x08, Local1)
And (Local1, 0xFF00, Local1)
ShiftRight (Local0, 0x08, Local0)
Or (Local0, Local1, Local0)
Store (Local0, Index (BATI, One))
Becomes
Multiply (SDA0, 0x0100, Local0)
Add (SDA1, Local0, Local0)
Store (Local0, Index (BATI, One))

Note that we first multiply XXX

**0** register then adding XXX

**1** register. It's differ from the guide and it is the key to get this patch working. I suspect you can also do this by changing order of the registers in ECR field and leave everything else as the guide says.

Next you need AppleSmartBatteryManager.kext and AppleACPIBatteryManager.kext that can be found in the guide. That's all, no voodoo kexts. Now Lion recognizes battery and can determine power source.There are some other changes - I've added 14th element to the BATI package as the guide says. I didn't find cycle count register so I left it Zero. Also cleaned some code but it's not necessary. Here is the final code

<pre class='_prettyXprint _lang-auto _linenums:0'>
Field (ECR, ByteAcc, Lock, Preserve)
{
Offset (0x18),
SPTR, 8,
SSTS, 8,
SADR, 8,
SCMD, 8,
SBFR, 256,
SCNT, 8,
Offset (0x80),
B1EX, 1,
, 1,
ACEX, 1,
Offset (0x81),
SWBE, 1,
DCBE, 1,
Offset (0x82),
WLST, 1,
OPST, 1,
Offset (0x83),
LIDS, 1,
Offset (0x84),
B1ST, 8,
Offset (0x86),
BRIT, 8,
Offset (0x93),
LUXH, 8,
LUXL, 8,
Offset (0xA0),
SRP0, 8,
SRP1, 8,
SRA0, 8,
SRA1, 8,
SPR0, 8,
SPR1, 8,
SVO0, 8,
SVO1, 8,
Offset (0xB0),
SDA0, 8,
SDA1, 8,
SDF0, 8,
SDF1, 8,
SDV0, 8,
SDV1, 8,
SDL0, 8,
SDL1, 8,
Offset (0xC0),
CTMP, 8,
Offset (0xC7),
TIST, 8,
Offset (0xD0),
STI0, 8,
STI1, 8,
SSE0, 8,
SSE1, 8,
SCR0, 8,
SCR1, 8,
STM0, 8,
STM1, 8
}
Device (BAT1)
{
Name (_HID, EisaId ("PNP0C0A"))
Name (_UID, One)
Name (BATI, Package (0x0E)
{
One,
0xFFFFFFFF,
0xFFFFFFFF,
One,
0xFFFFFFFF,
0x03,
0x0A,
One,
One,
"",
"",
"LION",
"SAMSUNG Electronics",
Zero
})
Method (_BIF, 0, NotSerialized)
{
If (LEqual (ECON, Zero))
{
Store (SECW (0x82, 0xB0, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, One))
}
Else
{
Store (Local0, Index (BATI, One))
}
Store (SECW (0x82, 0xB2, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x02))
}
Else
{
Store (Local0, Index (BATI, 0x02))
}
Store (SECW (0x82, 0xB4, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (BATI, 0x04))
}
Else
{
Store (Local0, Index (BATI, 0x04))
}
Store (Zero, Index (BATI, 0x05))
Store (SECW (0x82, 0xB6, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (Zero, Index (BATI, 0x06))
}
Else
{
Store (Local0, Index (BATI, 0x06))
}
}
Else
{
Multiply (SDA0, 0x0100, Local0)
Add (SDA1, Local0, Local0)
Store (Local0, Index (BATI, One))
Multiply (SDF0, 0x0100, Local0)
Add (SDF1, Local0, Local0)
Store (Local0, Index (BATI, 0x02))
Multiply (SDV0, 0x0100, Local0)
Add (SDV1, Local0, Local0)
Store (Local0, Index (BATI, 0x04))
Store (Zero, Index (BATI, 0x05))
Multiply (SDL0, 0x0100, Local0)
Add (SDL1, Local0, Local0)
Store (Local0, Index (BATI, 0x06))
}
Return (BATI)
}
Name (STAT, Package (0x04)
{
Zero,
Zero,
Zero,
Zero
})
Method (_BST, 0, NotSerialized)
{
If (LEqual (ECON, Zero))
{
Store (SECB (0x81, 0x84), Local0)
If (LAnd (LNotEqual (Local0, Zero), LNotEqual (Local0, 0x05)))
{
If (LEqual (PWRS, One))
{
Store (0x02, Local0)
}
Else
{
Store (One, Local0)
}
}
Store (Local0, Index (STAT, Zero))
Store (SECW (0x82, 0xA4, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, One))
}
Else
{
If (LGreaterEqual (Local0, 0x8000))
{
XOr (Local0, 0xFFFF, Local0)
Increment (Local0)
}
Store (Local0, Index (STAT, One))
}
Store (SECW (0x82, 0xA2, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, 0x02))
}
Else
{
Store (Local0, Index (STAT, 0x02))
}
Store (SECW (0x82, 0xA6, Zero), Local0)
If (LEqual (Local0, 0xFFFF))
{
Store (0xFFFFFFFF, Index (STAT, 0x03))
}
Else
{
Store (Local0, Index (STAT, 0x03))
}
}
Else
{
Store (B1ST, Local0)
If (LAnd (LNotEqual (Local0, Zero), LNotEqual (Local0, 0x05)))
{
If (LEqual (PWRS, One))
{
Store (0x02, Local0)
}
Else
{
Store (One, Local0)
}
}
Store (Local0, Index (STAT, Zero))
Multiply (SPR0, 0x0100, Local0)
Add (SPR1, Local0, Local0)
If (LGreaterEqual (Local0, 0x8000))
{
XOr (Local0, 0xFFFF, Local0)
Increment (Local0)
}
Store (Local0, Index (STAT, One))
Multiply (SRA0, 0x0100, Local0)
Add (SRA1, Local0, Local0)
Store (Local0, Index (STAT, 0x02))
Multiply (SVO0, 0x0100, Local0)
Add (SVO1, Local0, Local0)
Store (Local0, Index (STAT, 0x03))
}
Return (STAT)
}
Method (_STA, 0, NotSerialized)
{
If (LEqual (ECON, Zero))
{
If (LEqual (SECB (0x85, Zero), One))
{
Store (0x1F, Local0)
}
Else
{
Store (0x0F, Local0)
}
}
Else
{
If (LEqual (B1EX, One))
{
Store (0x1F, Local0)
}
Else
{
Store (0x0F, Local0)
}
}
Return (Local0)
}
Method (_PCL, 0, NotSerialized)
{
Return (_SB)
}
}</pre>