i am familiar with the files /sys/class/power_supply/BAT0/charge_control_{start,end}_threshold.
how can i tell, aside from observing whether the battery meter says the battery is being charged, whether the librem 14 is in the mode of charging? /sys/class/power_supply/AC/online will tell me whether the AC power is plugged in, but it won’t tell me if the librem 14 thinks it should have the charger enabled.
how can i force the librem 14 to change whether it thinks the charger should be enabled when the battery is charged to a percentage that is between the start and end threshold? the only way i know to do this is to change the thresholds and unplug and replug the AC power. but i don’t want to have to change the thresholds just to switch whether the librem 14 thinks it should be charging.
what smart charger chip is the librem 14 using? ti bq2478os? ti bq24715? o2 micro oz26786? something else?
is it possible to see the debug messages that are printed by the code in the .c files in /librem-ec/src/board/purism/common/charger/? that’s running on the ec, not on the main cpu, right? so there is no way to see these debug messages without special equipment, right?
and 1. You should first install purism_ectool, see this post here:
and then run:
sudo ./purism_ectool console
This will list continuous battery info (Voltage, mAh current), power state changes (charger (dis)connected, charging start, stop), CPU PL (Power Levels in Watts) and in the latest EC version (1.6 or 1.7), the detailed info about battery, including battery charging cycles count - that is not exported to /sys, so not visible in Power Statistics application.
best way to tell if the charger is supposed to be enabled or not is the power LED. If this turns green then the charger should be enabled, if it is white it should not charge
enforcing a charge cycle is best done through modifying the charge thresholds, i.e. temporarily setting the start charge threshold below the current state of charge then the power LED should turn green a short moment afterwards, after that the start threshold can be set back to its original value. I started a small tuning for this: https://source.puri.sm/nicole.faerber/librem-control
It is based on GTK+ and uses policy kit to get access to the settings. Warning: This is still work in progress, your mileage may vary Be especially careful please with the PL1/2 settings.
the charger chip used in the L14 is the BQ24715
@gsfs already answered this for runtime within a running Linux, but please be careful, for some reason I also do not understand yet running the console in Linux can hang the system after some time. You can also enable a hardware level debugging output without going through the OS in src/board/purism/common/common.mk but then you need an I2C device that can capture the output. We use the M0 Trinket from Adafruit and have a firmware for it here: https://source.puri.sm/firmware/librem-ec-i2c-debugger
Oh, and just one more hint, I just made a new EC firmware release 1.8 which should fix some issues…
you pick it up from here: https://source.puri.sm/firmware/librem-ec
are there plans for either librem-control or purism_ectool to be packaged in pureos? if they are already in pureos packages, what is(are) the name(s) of the package(s)? i searched and failed to find them in pureos.
thanks for the information that i do not need to unplug/replug the power supply from the librem 14 to get the charging mode (enabled or disabled) changed after changing /sys/class/power_supply/BAT0/charge_control_{start,end}_threshold. i am not sure why i had believed that unplugging and replugging the power supply was needed.
thanks for the information that purism_ectool allows viewing changes to the the charging-enabled status. is there a way to query the charging-enabled status without leaving a monitoring connection running all the time?
is there any documentation of purism_ectool? i am not seeing any in the git repo, but perhaps i am looking in the wrong places.
it seems that if i want to enable or disable charging mode by adjusting the start and/or end thresholds, then i need to keep a record somewhere else of what i want the long-term standard values of these thresholds to be so they can be set back to these long-term values. is there any plan for the librem-control utility to do this?
what are the PL1/2 settings that i need to be careful with?
thanks very much for the helpful information you have provided!
for the librem-control you can download a package from the CI pipeline: https://source.puri.sm/nicole.faerber/librem-control/-/jobs
It will also eventually move into PureOS. The ectool is more complicated I’m afraid, someone would still have to debianize the build…
with unplug and replug you can interrupt a charge cycle, so this is not totally wrong.
no. And even the ec-tool will not give you direct information about whether or not the charger is enabled. In the previous message you just asked for the debugging output and this iwhat you can get there.
the ectool has a commandline help, just call it with “-h” or so
the librem-control app has two buttons for exactly that - “Start charge now” and “Stop charge now”
with the PL1/2 setting you can increase the short and long term max power consumption of the CPU. I can not tell what could possibly be too much, that’s why I’m saying please be careful and watch your device when playing with these, things can go wrong when using values above the power on defaults (but from my POV should not)