When I get a mo I am going to play with the EC code to experiment with different behaviours:
- change it so that it never switches to battery while the psu is plugged in. I just don’t like its current behaviour and I think it is causing some of the battery cycling behaviour.
- the battery continually recalibrates itself so using battery percentages to decide whether to charge or not is doomed. The calculations need to be deterministic and use hysteresis.
- implement state transition counters and report them in the ectool chargecontrol command, so we can keep track of even the really short charge/discharge events that would otherwise go unnoticed.
- analyse why it appears to overcharge (above configured charge limit) while suspended with the psu plugged in.
- stop it from setting the CHARGE flag when it is idle and not charging.
- the EC source code for charging is a bit spidery and difficult to understand, so the above 5 things could take a while.
- if there is a mode where both the battery and psu is supposed to be on at the same time, powering the cpu, then i will add a state for that so one can see when it happens by looking at the counters.
I have found a way to play safely with the EC code without risking a bricked laptop. I have a modified version of the ec firmware writer that helps make it safe to use and not accidentally write bricked code.
Essentially, I only ever write to the RW second image in the firmware, and if anything goes wrong I can easily force it back to RO. Simply powering off resets it to RO.