Contribute
Register

[Guide] How to patch DSDT for working battery status

Hey RehabMan,

I patched my DSDT with your repo and used the R411 Samsung fix for my R780 Laptop. Battery status is working and shown after patching DSDT and placing ACPIbattery.kext
However my Bluetooth connection goes wonky and my connected MagicMouse jumps like crazy to the top whenever I lift it. Scrolling also goes haywire. After deleting the .kext everything is working as it should. I have no other kext except VoodooPS2 running until now.

Do you have an explanation for this behaviour?

TIA
 
Hey RehabMan,

I patched my DSDT with your repo and used the R411 Samsung fix for my R780 Laptop. Battery status is working and shown after patching DSDT and placing ACPIbattery.kext
However my Bluetooth connection goes wonky and my connected MagicMouse jumps like crazy to the top whenever I lift it. Scrolling also goes haywire. After deleting the .kext everything is working as it should. I have no other kext except VoodooPS2 running until now.

Do you have an explanation for this behaviour?

TIA

Off-topic. Open a separate thread for non-battery related problems.
 
I created the battery patch for surface pro 3 using this guide.
Thanks for such informative post.

I confirmed it working on Surface pro 3 with the ACPIBatteryManager.kext on 10.10.2
 

Attachments

  • battery_Surface-Pro-v3.txt
    4.7 KB · Views: 132
I created the battery patch for surface pro 3 using this guide.
Thanks for such informative post.

I confirmed it working on Surface pro 3 with the ACPIBatteryManager.kext on 10.10.2

Post also your native DSDT. I will not add patches to the repo unless they can be verified/reviewed.
 
By native, do you mean before the patch? here is the DSDT before the patch
 

Attachments

  • DSDT.aml.beforebatterypatch.zip
    18.5 KB · Views: 94
Hello,

I'm trying to get the battery status working on the ThinkPad Yoga; so far to no avail, however. I appreciate every help to get this working!

Here is what I have done so far:
I followed the instructions in the first post. The good news there was that only one value (HWAK) needed work (altogether there were six, but only the one was accessed). However, that value was also written to. After consulting the ACPI spec I decided to use Store for the lower byte and ShiftRight for the upper byte to store the Local0 variable in the two newly created ones, but I am highly unsure whether this is correct. It compiles, but that doesn't necessarily mean it is useful. Also I have used the debug variant of ACPIBatteryManager.kext and received the following output from dmesg:

Code:
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 2
AppleSmartBattery::pollBatteryState: path = 1
AppleSmartBatteryManager::getBatterySTA called
AppleSmartBattery::setBatterySTA: battery_status = 0x1f
AppleSmartBatteryManager::getBatteryBIF called
AppleSmartBatteryManager::getBatteryBIF: validateObject return 0xe00002bc
AppleSmartBatteryManager::getBatteryBIF: evaluateObject error 0xe00002bc
AppleSmartBatteryManager::getBatteryBST called
AppleSmartBatteryManager::getBatteryBST: evaluateObject error 0xe00002c2

I attached the patched DSDT to this post.

Quick edit
I forgot to mention this post, where it is stated that BIF function fails (So the dmesg output did not surprise me that much). But while the post also talks about a Yoga, the model differs and it seems for me BST fails also: http://www.tonymacx86.com/mavericks-laptop-support/129864-mavericks-lenovo-thinkpad-yoga.html
 

Attachments

  • DSDT_patched.zip
    41.1 KB · Views: 89
I created the battery patch for surface pro 3 using this guide.
Thanks for such informative post.

I confirmed it working on Surface pro 3 with the ACPIBatteryManager.kext on 10.10.2

The translation on the 16-bit EC writes... are wrong...

For example:
Code:
into method label _BTP code_regex Store\s+\(Arg0,\s+\^\^SBRG\.EC0\.B0AH\) replace_matched begin Store(ShiftRight(Arg0, 8), ^^SBRG.EC0.AH00) Store(Arg0, ^^SBRG.EC0.AH01) end;

Should be:
Code:
into method label _BTP code_regex Store\s+\(Arg0,\s+\^\^SBRG\.EC0\.B0AH\) replace_matched begin Store(Arg0, ^^SBRG.EC0.AH00) Store(ShiftRight(Arg0, 8), ^^SBRG.EC0.AH01) end;

The first field of a 16-bit register broke into two is the LSB... second MSB.

Let me know when you fix it and re-test.
 
Thanks for your help. Fixed and deployed the updated DSDT on my surface pro 3. It seems to work better than before. battery icon used to show no battery every few seconds. it no longer does that with this updated patch

One small question though. Battery "until full time" does not seems accurate (says 10 min to charge from 50% to 110%). Do you think anything in the patch can help with that?
 

Attachments

  • battery_Surface-Pro-3-v2.txt
    4.7 KB · Views: 104
The translation on the 16-bit EC writes... are wrong...
Hi!
Just have to say that your work is perfect!

Tried to patch DSDT for Asus N55SL and it seems near to match with battery_ASUS-G75vw.txt (https://github.com/RehabMan/Laptop-DSDT-Patch/blob/master/battery/battery_ASUS-G75vw.txt) patch. Only 2 syntax errors encountered in which B1B2 method set out of DefinitionBlock's closing brace. Like this:
Code:
    Method (WAK, 1, NotSerialized)
    {
        \_SB.ATKD.GENW (Arg0)
        \_SB.PCI0.GFX0.OWAK (Arg0)
        \OEMW (Arg0)
    }
}
Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }
And not patched OLPM method's field B0DC:
Code:
        Method (OLPM, 0, Serialized)
        {
            If (LEqual (\_SB.ACPF, 0x00))
            {
                If (LLessEqual (\_SB.PCI0.SBRG.EC0.B0DC, 0x0BB8))
                {
                    Store (One, \_SB.SLMT)
                }
            }
        }
I've patched it manually.

Could you write some extension to your Guide about WECB Method and using it for writing to EC's fields.
I know that it is usable now for some machines and very handy versus WRBA. Because in the repo it is not completely understandable what to do with the third Argument Arg2.

It is very handy to use RECB and WECB for the "big" fields, but to 16, 32, 64 and so on it is handy too.
Like this:
Code:
            OperationRegion (SMBX, EmbeddedControl, 0x18, 0x28)
            Field (SMBX, ByteAcc, NoLock, Preserve)
            {
                PRTC,   8, // 0x18
                SSTS,   5, //
                    ,   1, //
                ALFG,   1, //
                CDFG,   1, // 0x19
                ADDR,   8, // 0x1A
                CMDB,   8, // 0x1B
                BDAT,   256, // 0x1C  <----- like RehabMan's code
                BCNT,   8, 
                    ,   1, 
                ALAD,   7, 
                ALD0,   8, 
                ALD1,   8
            }

            OperationRegion (SMB2, EmbeddedControl, 0x40, 0x28)
            Field (SMB2, ByteAcc, NoLock, Preserve)
            {
                PRT2,   8, // 0x40
                SST2,   5, 
                    ,   1, 
                ALF2,   1, 
                CDF2,   1, // 0x41
                ADD2,   8, // 0x42
                CMD2,   8, // 0x43
                BDA2,   256, // 0x44  <----- like RehabMan's code
                BCN2,   8, 
                    ,   1, 
                ALA2,   7, 
                ALR0,   8, 
                ALR1,   8
            }
...
                Offset (0x93), 
                TAH0,   16, // 0x93
                TAH1,   16, // 0x95
...
                Offset (0xF4), 
                B0SN,   16,   // 0xF4
                 
                Offset (0xFC), 
                B1SN,   16    // 0xFC
...
                Offset (0xA0), 
                B0VL,   16, // 0xA0
                B0RC,   16, // 0xA2
                B0FC,   16, // 0xA4
                B0MD,   16, // 0xA6
                B0ST,   16, // 0xA8
                B0CC,   16, // 0xAA
                B0DC,   16, // 0xAC
                B0DV,   16, // 0xAE
                B1VL,   16, // 0xB0
                B1RC,   16, // 0xB2
                B1FC,   16, // 0xB4
                B1MD,   16, // 0xB6
                B1ST,   16, // 0xB8
                B1CC,   16, // 0xBA
                B1DC,   16, // 0xBC
                B1DV,   16  // 0xBE
Code:
// Store (DerefOf (Index (Arg6, 0x01)), BDAT)
WECB (0x1c, 256, DerefOf (Index (Arg6, 0x01))) // <<------------ WECB

...

// Store (DerefOf (Index (Arg6, 0x01)), BDA2)
WECB (0x44, 256, DerefOf (Index (Arg6, 0x01))) // <<------------ WECB

...

//  Store (Arg4, BDAT)
WECB (0x1c, 256, Arg4) // <<------------ WECB

...

// Store (0x00, BDAT)
WECB (0x1c, 256, 0x00) // <<------------ WECB
...
// Store (0x00, BDAT)
WECB (0x1c, 256, 0x00) // <<------------ WECB
...
// Store (BDAT, Index (Local0, 0x02))
Store (RECB (0x1c, 256), Index (Local0, 0x02)) // <<------------ RECB
But also with 16 bit fields:
Code:
                {
                  //Store (B1SN, Local0)
                    Store (RECB (0xFC, 16), Local0) // <<------------ RECB
                }
                Else
                {
                  //Store (B0SN, Local0)
                    Store (RECB (0xF4, 16), Local0) // <<------------ RECB
                }
...
                    If (LEqual (_T_0, 0x00))
                    {
                      //Store (TAH0, Local0)
                        Store (RECB (0x93, 16), Local0) // <<------------ RECB
                        Break
                    }
                    Else
                    {
                        If (LEqual (_T_0, 0x01))
                        {
                          //Store (TAH1, Local0)
                            Store (RECB (0x95, 16), Local0) // <<------------ RECB
                            Break
                        }
and so on.

Thank you so much!

*** PS. Could you explain me one more time why it is needed to patch in ACPI code those >8bit fields, but not to translate them completely by kext?
 

Attachments

  • N55SL.zip
    113.8 KB · Views: 91
Back
Top