最后的 dsdt 修改支持 电池点亮显示,主要参考: (重新修正)dsdt之BAT修改 for AppleACPIBatteryManager.kext

具体的修改逻辑,我就不说了,,内容太多,直接上修改代码:

在最后GTAP后添加如下方法:

Method (B1B2, 2, NotSerialized) { Or (ShiftLeft (Arg1, 0x08), Arg0, Local0) Return (Local0) } Method (B1B4, 4, NotSerialized) { Or (ShiftLeft (Arg1, 0x08), Arg0, Local0) Or (ShiftLeft (Arg2, 0x10), Local0, Local0) Or (ShiftLeft (Arg3, 0x18), Local0, Local0) Return (Local0) } Method (L1L4, 4, NotSerialized) { Or (ShiftLeft (Arg1, 0x20), Arg0, Local0) Or (ShiftLeft (Arg2, 0x40), Local0, Local0) Or (ShiftLeft (Arg3, 0x60), Local0, Local0) Return (Local0) } Method (L1L6, 6, NotSerialized) { Or (ShiftLeft (Arg1, 0x20), Arg0, Local0) Or (ShiftLeft (Arg2, 0x40), Local0, Local0) Or (ShiftLeft (Arg3, 0x60), Local0, Local0) Or (ShiftLeft (Arg4, 0x80), Local0, Local0) Or (ShiftLeft (Arg5, 0xA0), Local0, Local0) Return (Local0) } Method (D2D4, 2, NotSerialized) { Or (ShiftLeft (Arg1, 0x80), Arg0, Local0) Return (Local0) }

搜索 PNP0C0A ,查到 BAT0 节点:

                    Device (BAT0)                     {                         Name (HID, EisaId ("PNP0C0A"))                         Name (UID, Zero)                         Name (_PCL, Package (0x01)

修改该节点的信息向上的信息为以下内容(该内容包含了按照上面文章修改的信息,可以用显示电池信息)。。。

修改的起点为:Field (ECOR, ByteAcc, NoLock, Preserve);

Field (ECOR, ByteAcc, NoLock, Preserve) { Offset (0xA0), DBR0, 8, DBR1, 8, DBF0, 8, DBF1, 8, SBAE, 16, SBRS, 16, DAC0, 8, DAC1, 8, DBO0, 8, DBO1, 8, SBAF, 16, SBBS, 16 } Field (ECOR, ByteAcc, NoLock, Preserve) { Offset (0xA0), , 15, SBCM, 1, SBMD, 16, SBCC, 16 } Field (ECOR, ByteAcc, NoLock, Preserve) { Offset (0xA0), DBD0, 8, DBD1, 8, DBV0, 8, DBV1, 8, SBOM, 16, SBSI, 16, SBDT, 16, DBS0, 8, DBS1, 8 } Field (ECOR, ByteAcc, NoLock, Preserve) { Offset (0xA0), DBC0, 8, DBC1, 8, DBC2, 8, DBC3, 8 } Field (ECOR, ByteAcc, NoLock, Preserve) { Offset (0xA0), DM00, 8, DM01, 8, DM02, 8, DM03, 8, DM04, 8, DM05, 8, DM06, 8, DM07, 8, DM08, 8, DM09, 8, DM10, 8, DM11, 8, DM12, 8, DM13, 8, DM14, 8, DM15, 8 } Field (ECOR, ByteAcc, NoLock, Preserve) { Offset (0xA0), DN00, 8, DN01, 8, DN02, 8, DN03, 8, DN04, 8, DN05, 8, DN06, 8, DN07, 8, DN08, 8, DN09, 8, DN10, 8, DN11, 8, DN12, 8, DN13, 8, DN14, 8, DN15, 8 } Mutex (BATM, 0x07) Method (GBIF, 3, NotSerialized) { Acquire (BATM, 0xFFFF) If (Arg2) { Or (Arg0, One, HIID) Sleep (0x14) Store (SBCM, Local7) XOr (Local7, One, Index (Arg1, Zero)) Store (Arg0, HIID) Sleep (0x14) If (Local7) { Multiply (B1B2 (DBF0, DBF1), 0x0A, Local1) } Else { Store (B1B2 (DBF0, DBF1), Local1) } Store (Local1, Index (Arg1, 0x02)) Or (Arg0, 0x02, HIID) Sleep (0x14) If (Local7) { Multiply (B1B2 (DBD0, DBD1), 0x0A, Local0) } Else { Store (B1B2 (DBD0, DBD1), Local0) } Store (Local0, Index (Arg1, One)) Divide (Local1, 0x14, Local2, Index (Arg1, 0x05)) If (Local7) { Store (0xC8, Index (Arg1, 0x06)) } Else { If (B1B2 (DBV0, DBV1)) { Divide (0x00030D40, B1B2 (DBV0, DBV1), Local2, Index (Arg1, 0x06)) } Else { Store (Zero, Index (Arg1, 0x06)) } } Store (B1B2 (DBV0, DBV1), Index (Arg1, 0x04)) Store (B1B2 (DBS0, DBS1), Local0) Name (SERN, Buffer (0x06) { " " }) Store (0x04, Local2) While (Local0) { Divide (Local0, 0x0A, Local1, Local0) Add (Local1, 0x30, Index (SERN, Local2)) Decrement (Local2) } Store (SERN, Index (Arg1, 0x0A)) Or (Arg0, 0x06, HIID) Sleep (0x14) Store (L1L4 (B1B4 (DN00, DN01, DN02, DN03), B1B4 (DN04, DN05, DN06, DN07), B1B4 (DN08, DN09, DN10, DN11), B1B4 (DN12, DN13, DN14, DN15)), Index (Arg1, 0x09)) Or (Arg0, 0x04, HIID) Sleep (0x14) Name (BTYP, Buffer (0x05) { 0x00, 0x00, 0x00, 0x00, 0x00 }) Store (B1B4 (DBC0, DBC1, DBC2, DBC3), BTYP) Store (BTYP, Index (Arg1, 0x0B)) Or (Arg0, 0x05, HIID) Sleep (0x14) Store (L1L4 (B1B4 (DM00, DM01, DM02, DM03), B1B4 (DM04, DM05, DM06, DM07), B1B4 (DM08, DM09, DM10, DM11), B1B4 (DM12, DM13, DM14, DM15)), Index (Arg1, 0x0C)) } Else { Store (0xFFFFFFFF, Index (Arg1, One)) Store (Zero, Index (Arg1, 0x05)) Store (Zero, Index (Arg1, 0x06)) Store (0xFFFFFFFF, Index (Arg1, 0x02)) } Release (BATM) Return (Arg1) } Scope (HKEY) { Method (SBIG, 1, NotSerialized) { If (ECIF) { Return (Zero) } Return (BTIF ()) } } Method (GBST, 4, NotSerialized) { Acquire (BATM, 0xFFFF) If (And (Arg1, 0x20)) { Store (0x02, Local0) } Else { If (And (Arg1, 0x40)) { Store (One, Local0) } Else { Store (Zero, Local0) } } If (And (Arg1, 0x07)) {} Else { Or (Local0, 0x04, Local0) } If (LEqual (And (Arg1, 0x07), 0x07)) { Store (0x04, Local0) Store (Zero, Local1) Store (Zero, Local2) Store (Zero, Local3) } Else { Sleep (0x32) Store (Arg0, HIID) Sleep (0x32) Store (HIID, Local6) If (LNotEqual (Arg0, Local6)) { Release (BATM) Return (Arg3) } Store (B1B2 (DBO0, DBO1), Local3) If (Arg2) { Multiply (B1B2 (DBR0, DBR1), 0x0A, Local2) } Else { Store (B1B2 (DBR0, DBR1), Local2) } Store (B1B2 (DAC0, DAC1), Local1) If (LGreaterEqual (Local1, 0x8000)) { If (And (Local0, One)) { Subtract (0x00010000, Local1, Local1) } Else { Store (Zero, Local1) } } Else { If (LNot (And (Local0, 0x02))) { Store (Zero, Local1) } } If (Arg2) { Multiply (Local3, Local1, Local1) Divide (Local1, 0x03E8, Local7, Local1) } } Store (Local0, Index (Arg3, Zero)) Store (Local1, Index (Arg3, One)) Store (Local2, Index (Arg3, 0x02)) Store (Local3, Index (Arg3, 0x03)) Release (BATM) Return (Arg3) }

保存重启后,就可以用这个驱动 https://code.google.com/p/os-x-acpi-battery-driver/downloads/list 这里的驱动调用原生驱动显示电池信息了。