Contribute
Register

[Guide] How to patch DSDT for working battery status

I just thought that returning a 'zero' would be a bit better then leaving a buffer with unknown value. Anyway both methods would work =))

The system returns zero upon exit from a method with no 'Return' in the code path.
 
Thanks, patched DSDT according to instructions and now working with your battery kext, but am unsure how to create maciASL patch.

Here is the diff:
Code:
42a43,44
>     Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }
>     
16058a16061,16105
>             Method (RE1B, 1, NotSerialized)
>             {
>                 OperationRegion(ERAM, EmbeddedControl, Arg0, 1)
>                 Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }
>                 Return(BYTE)
>             }
>             Method (RECB, 2, Serialized)
>             // Arg0 - offset in bytes from zero-based EC
>             // Arg1 - size of buffer in bits
>             {
>                 ShiftRight(Arg1, 3, Arg1)
>                 Name(TEMP, Buffer(Arg1) { })
>                 Add(Arg0, Arg1, Arg1)
>                 Store(0, Local0)
>                 While (LLess(Arg0, Arg1))
>                 {
>                     Store(RE1B(Arg0), Index(TEMP, Local0))
>                     Increment(Arg0)
>                     Increment(Local0)
>                 }   
>                 Return(TEMP)
>             }
>             Method (WE1B, 2, NotSerialized)
>             {
>                 OperationRegion(ERAM, EmbeddedControl, Arg0, 1)
>                 Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }
>                 Store(Arg1, BYTE)
>             }
>             Method (WECB, 3, Serialized)
>             // Arg0 - offset in bytes from zero-based EC
>             // Arg1 - size of buffer in bits
>             // Arg2 - value to write
>             {
>                 ShiftRight(Arg1, 3, Arg1)
>                 Name(TEMP, Buffer(Arg1) { })
>                 Store(Arg2, TEMP)
>                 Add(Arg0, Arg1, Arg1)
>                 Store(0, Local0)
>                 While (LLess(Arg0, Arg1))
>                 {
>                     WE1B(Arg0, DerefOf(Index(TEMP, Local0)))
>                     Increment(Arg0)
>                     Increment(Local0)
>                 }
>             }
16414c16461
<                 SMD0,   256, 
---
>                 SMDX,   256, //SMD0 0x175
16579c16626,16628
<                 ERIB,   16, 
---
>                 //ERIB,   16, 
>                 RIB0,   8,
>                 RIB1,   8,
16601c16650
<                 ERIB = Arg0
---
>                 B1B2(RIB0,RIB1) = Arg0
16610c16659
<                 ERIB = Arg0
---
>                 B1B2(RIB0,RIB1) = Arg0
16746c16795,16796
<                                 SMD0 = Zero
---
>                                 //SMD0 = Zero
>                                 WECB(0x175,256,Zero)
16766c16816
<                                         Local3 = SMD0 /* \_SB_.PCI0.LPCB.EC0_.SMD0 */
---
>                                         Local3 = RECB(0x175,256) /* \_SB_.PCI0.LPCB.EC0_.SMD0 */

Used all helper methods you provided :p
Original DSDT after correcting an error by commenting out a line and the patched DSDT is attached.
View attachment dsdts.zip zipped as the system says the dsl files are too big...

My laptop is Acer Aspire R7-572G with nVidia GT 750M and i7-4500.
 
Thanks, patched DSDT according to instructions and now working with your battery kext, but am unsure how to create maciASL patch.

Here is the diff:
Code:
42a43,44
>     Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }
>     
16058a16061,16105
>             Method (RE1B, 1, NotSerialized)
>             {
>                 OperationRegion(ERAM, EmbeddedControl, Arg0, 1)
>                 Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }
>                 Return(BYTE)
>             }
>             Method (RECB, 2, Serialized)
>             // Arg0 - offset in bytes from zero-based EC
>             // Arg1 - size of buffer in bits
>             {
>                 ShiftRight(Arg1, 3, Arg1)
>                 Name(TEMP, Buffer(Arg1) { })
>                 Add(Arg0, Arg1, Arg1)
>                 Store(0, Local0)
>                 While (LLess(Arg0, Arg1))
>                 {
>                     Store(RE1B(Arg0), Index(TEMP, Local0))
>                     Increment(Arg0)
>                     Increment(Local0)
>                 }   
>                 Return(TEMP)
>             }
>             Method (WE1B, 2, NotSerialized)
>             {
>                 OperationRegion(ERAM, EmbeddedControl, Arg0, 1)
>                 Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }
>                 Store(Arg1, BYTE)
>             }
>             Method (WECB, 3, Serialized)
>             // Arg0 - offset in bytes from zero-based EC
>             // Arg1 - size of buffer in bits
>             // Arg2 - value to write
>             {
>                 ShiftRight(Arg1, 3, Arg1)
>                 Name(TEMP, Buffer(Arg1) { })
>                 Store(Arg2, TEMP)
>                 Add(Arg0, Arg1, Arg1)
>                 Store(0, Local0)
>                 While (LLess(Arg0, Arg1))
>                 {
>                     WE1B(Arg0, DerefOf(Index(TEMP, Local0)))
>                     Increment(Arg0)
>                     Increment(Local0)
>                 }
>             }
16414c16461
<                 SMD0,   256, 
---
>                 SMDX,   256, //SMD0 0x175
16579c16626,16628
<                 ERIB,   16, 
---
>                 //ERIB,   16, 
>                 RIB0,   8,
>                 RIB1,   8,
16601c16650
<                 ERIB = Arg0
---
>                 B1B2(RIB0,RIB1) = Arg0
16610c16659
<                 ERIB = Arg0
---
>                 B1B2(RIB0,RIB1) = Arg0
16746c16795,16796
<                                 SMD0 = Zero
---
>                                 //SMD0 = Zero
>                                 WECB(0x175,256,Zero)
16766c16816
<                                         Local3 = SMD0 /* \_SB_.PCI0.LPCB.EC0_.SMD0 */
---
>                                         Local3 = RECB(0x175,256) /* \_SB_.PCI0.LPCB.EC0_.SMD0 */

Used all helper methods you provided :p
Original DSDT after correcting an error by commenting out a line and the patched DSDT is attached.
View attachment 152628 zipped as the system says the dsl files are too big...

My laptop is Acer Aspire R7-572G with nVidia GT 750M and i7-4500.

Your files are disassembled incorrectly. See guide: http://www.tonymacx86.com/yosemite-laptop-support/152573-guide-patching-laptop-dsdt-ssdts.html
 
Somehow coconutBattery shows my battery age as a negative number and battery temperature as absolute zero... and it says no power adapter found. Also, the charge level shown by mac is always at 99% for a long time without going to 100%. Is that normal?

Not normal. DSDT not correctly patched for battery status.
 
Not normal. DSDT not correctly patched for battery status.
Oh well it went to 100% now lol.

Have to look at it again for the battery status stuff...

If it says SMD0=Zero, does it mean write zero to SMD0? So is it equivalent to WECB(0x175,256,Zero), if the offset and lengths are specified correctly?

Also, there is an existing ERAM operating region in my DSDT, so does it matter if your helper methods are using the same region?
 
Oh well it went to 100% now lol.

Have to look at it again for the battery status stuff...

If it says SMD0=Zero, does it mean write zero to SMD0? So is it equivalent to WECB(0x175,256,Zero), if the offset and lengths are specified correctly?

It sounds like you didn't disassemble your files correctly...

Use the "-dl" option so you get "Store(Zero, SMD0)" instead of "SMD0 = Zero".

But yes, a store of Zero to SMD0 would be the same as WECB(offset, size, Zero). Correct specification of the offset and size is critical.

Also, there is an existing ERAM operating region in my DSDT, so does it matter if your helper methods are using the same region?

I don't understand the question. Declarations are local to the scope of the declaration.
 
Hello my Name ist Musti.

I bought a Samsung Rc720.

I managed to Install 10.10.5 Yosemite. Almost everything is working.

Only Battery not.

Here is my DSDT Extracted with MacIASL-

Hope someone can edit my DSDT.

Thank you
 

Attachments

  • System DSDT.aml
    32.4 KB · Views: 69
Back
Top