Skip to content

Implementing battery thresholds #29

@ldan93

Description

@ldan93

First, thank you for your great work !

There is one feature of our Matebook that I miss from Windows/Linux : setting battery thresholds.

What is it ?

When you use your laptop plugged in the AC power for a long time, it’s healthier to keep your battery mid-charged. So, if you rarely use your Matebook in battery mode, setting a threshold greatly increases your battery’s lifespan in the long-run.

How does it work ?

There is a minimum and a maximum values stored inside the Embedded Controller (EC) within the ACPI tables. For example, if you set it to 50 / 60, your battery will charge up to a value between 50% and 60% and then, the computer will only drain power from AC, letting your battery idle.

Under Windows, this feature is handled by Huawei’s built-in « PC Manager ». Under Linux, it has been implemented through scripts writing custom values to the EC tables (https://github.com/nekr0z/linux-on-huawei-matebook-13-2019/blob/master/batpro) or through cleaner ACPI methods (https://github.com/aymanbagabas/Huawei-WMI).

How can we make it work under MacOS ?

From what I understand from nekr0z’s script, to implement this feature, all we have to do it to write the minimum and maximum thresholds to the 0xe4 and 0xe5 registries of the EC’s tables (nekr0z/linux-on-huawei-matebook-13-2019#2 (comment)).

People successfully implemented this feature for other laptop brands using RehabMan’s kext OS-X-ACPI-Poller (https://github.com/RehabMan/OS-X-ACPI-Poller). An example with Lenovo laptops : https://www.insanelymac.com/forum/topic/342280-battery-charge-thresholds-and-related-controls/

This method seems to be very similar to RehabMan’s approach to controlling fans through custom EC values : https://www.tonymacx86.com/threads/new-fan-control-dsdt-for-silent-fan-at-higher-temps.72043/

I’ve spent some time collecting all of the useful details, but actually implementing this feature for the Matebook X Pro is way beyond my personal abilities… ATM, I use a Linux USB installation to set the threshold from there, and I then reboot to MacOS. But this is far from convenient, and the values get reset from time to time…

I think adding this feature to your guide would be very nice and useful for many users. Would you be interested to have a look at it ? Even though I’m a total beginner with Hackintosh, I would do my best to help you, of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions