#Trying to set charge limit on a HUAWEI laptop [Solution Found]

21 messages · Page 1 of 1 (latest)

solid hinge
#

UPDATE:
I have a janky solution.
For whatever reason when I first boot into Windows, then boot back into Linux Mint the the charging limit is applied. just make sure that you have applied the charging limit with the same limit value in Windows via Huawei's in-house PC Manager.

Please I am desperate, I've gone into forums for several months now and no one has the solution. Please lend a hand if you know anything.

Output for sudo tlp-stat -b:

TLP 1.6.1

+++ Battery Care
Plugin: huawei
Supported features: charge thresholds
Driver usage:

  • vendor (huawei_wmi) = active (charge thresholds)
    Parameter value ranges:
  • START_CHARGE_THRESH_BAT0: 0(default)..99
  • STOP_CHARGE_THRESH_BAT0: 1..100(default)

/sys/devices/platform/huawei-wmi/charge_control_thresholds = 40 70 [%]

+++ Battery Status: BAT1
/sys/class/power_supply/BAT1/manufacturer = Sunwoda-H
/sys/class/power_supply/BAT1/model_name = HB4692Z9ECW-41
/sys/class/power_supply/BAT1/cycle_count = 641
/sys/class/power_supply/BAT1/charge_full_design = 3615 [mAh]
/sys/class/power_supply/BAT1/charge_full = 2646 [mAh]
/sys/class/power_supply/BAT1/charge_now = 1969 [mAh]
/sys/class/power_supply/BAT1/current_now = 1613 [mA]
/sys/class/power_supply/BAT1/status = Charging

Charge = 74.4 [%]
Capacity = 73.2 [%]

I used to be able to set a charge limit to 70% on Bazzite KDE and it worked, but since switching to Mint I haven't been able to get it work.

I've tried TLP, set charge threshold to 40 70 but it still does not work at all.

Any solutions? also one thing to note: when I booted up Mint for the first time it limited my battery to 69% without configuring TLP, very strange. since then obviously it did not persist.

hardy nova
#

if TLP's settings are being ignored, the next step is to try writing the charge thresholds directly to the kernel's sysfs file. This bypasses TLP and helps determine if the huawei-wmi driver itself is working as expected.

Manually Apply Thresholds: Open a terminal and run the following command to set the stop threshold to 70%:
echo "40 70" | sudo tee /sys/devices/platform/huawei-wmi/charge_control_thresholds
After running this command, check if the battery stops charging once it reaches 70%. You can monitor this with the acpi command or by watching your desktop environment's battery indicator.

#

After looking into this, it seems like it's a driver issue and that's why it's important to test the driver with the command above and monitor to see if it goes past 70%⬆️

#

I would imagine you need to not be at 70% or above on battery charge to ensure proper deployment of the manual change

primal oxide
#

try TLP-UI
it may have some setting for it. research.

solid hinge
#

didn't work

#

the driver can't be the issue right? isn't it the kernel?
I used kernel 6.13 on bazzite and battery limiting via KDE worked no issues.

hardy nova
solid hinge
solid hinge
#

UPDATE:
I have a janky solution.
For whatever reason when I first boot into windows, then boot back into Linux Mint the the charging limit is applied. Just make sure that you have applied the charging limit with the same limit value in Windows via Huawei's in-house PC Manager.

#

Trying to set charge limit on a laptop [SEMI-SOLVED]

hardy nova
#

So you have what we call in the industry, a "workaround". until its fully fixed. I
imagine that your hardware must recognize some sort of windows specific driver setting to do the limit. possible security thingamajig

solid hinge
#

So, news. I have a permanent solution as of today. (HUAWEI MateBook exclusive)

I wrote a script that runs on startup which ulitises the huawei-wmi driver (kernel 5.5+) to limit battery life.

#

there are several references that have been very beneficial to this tiny script:

https://github.com/aymanbagabas/Huawei-WMI
https://github.com/aymanbagabas/Huawei-WMI/issues/55#issuecomment-1028953673
https://github.com/qu1x/huawei-wmi#smart-charge

DISCLAIMER: I have only tested this on KDE. I have no spare machine/ssd to test this on Cinammon, as I need my laptop for work.

And basically what you need to do is:

  1. Make sure that you have power-profiles-daemon installed (I haven't tested TLP yet, sorry but it should theoretically work)
  2. Write a bash script and a service that tells /sys/kernel/debug/huawei-wmi/arg to switch to 0x462848011503
  3. call /sys/kernel/debug/huawei-wmi/call
    TWICE, command below
    sudo cat /sys/kernel/debug/huawei-wmi/call
  4. And make that switch persistent after rebooting.
GitHub

Huawei WMI laptop extras linux driver. Contribute to aymanbagabas/Huawei-WMI development by creating an account on GitHub.

GitHub

Sets group write privileges and reinstates battery charge-thresholds. - qu1x/huawei-wmi

GitHub

Hi, I just updated my BIOS from version 1.11 to version 1.17 on my HUAWEI MateBook D 15 AMD. After that, setting charge thresholds on Linux as stopped working. Everything else like FN lock and mic ...

#

test this at your own risk. I take zero responsibility if anything behaves weirdly due to misconfiguration

#

I will post another update once I have made sure that the script does not malfunction, and is stable for general use. Likely within this week tho

#

Trying to set charge limit on a laptop [Solution Found]

#

Trying to set charge limit on a HUAWEI laptop [Solution Found]

solid hinge
#

3 month update:

oops, apologies for the absence. college was hectic, and this slipped my mind.

Charge limiting has been working flawlessly for quite a while now, nothing broke.

Anyone who has a huawei matebook and would like to try out charge limiting, you may follow the steps previously mentioned.