BeardOverflow / msi-ec

GNU General Public License v2.0
145 stars 45 forks source link

Charge control broken on MSI Alpha 15 B5EEK #56

Closed Tungsten842 closed 1 year ago

Tungsten842 commented 1 year ago

I have an msi alpha B5EEK-070 with bios version: E158LAMS.10B and linux 6.4. Charge control doesn't seem to work, both charge_control_start_threshold and charge_control_end_threshold report strange values and when I tried to change charge_control_end_threshold the fan started to spin very fast.

cat /sys/class/power_supply/BAT1/charge_control_start_threshold
-10
cat /sys/class/power_supply/BAT1/charge_control_end_threshold
0
teackot commented 1 year ago

Hello!

The reason end_threshold shows 0 is that sometimes on fresh boot the embedded controller resets this parameter to 0. I think the battery will either charge all the way up to 100 or up to the last threshold you've set.

The start and end thresholds are always 10% apart due to hardware limitations, so to calculate the start threshold we just subtract 10 from the end threshold.

TODO: make charge_control_start_threshold show 0 when it is negative

when I tried to change charge_control_end_threshold the fan started to spin very fast

Are you sure it started to spin because of this? If so, this is a critical issue

teackot commented 1 year ago

Also, did charge_control_end_threshold still show 0 after you changed it or did it show the new value?

Tungsten842 commented 1 year ago

Hello!

The reason end_threshold shows 0 is that sometimes on fresh boot the embedded controller resets this parameter to 0. I think the battery will either charge all the way up to 100 or up to the last threshold you've set.

The start and end thresholds are always 10% apart due to hardware limitations, so to calculate the start threshold we just subtract 10 from the end threshold.

TODO: make charge_control_start_threshold show 0 when it is negative

when I tried to change charge_control_end_threshold the fan started to spin very fast

Are you sure it started to spin because of this? If so, this is a critical issue

I tried again and it seems that everything works now, Basically I edited charge_control_end_threshold with vim and when I saved the file vim crashed, I thought that the fan started to spin because of the change but in reality it was vim that exploded and was using a lot of cpu:joy:. Anyway, both thresholds seems to work and they are remembered across reboots. Should I close this issue or should I keep it opened for the negative start threshold problem?

teackot commented 1 year ago

Glad everything works now =)

Let's keep the issue for now