I know there is an issue with the battery indicator, but I’ve noticed that it gives a better estimate after a reboot. I’m wondering if there is a command to force the battery level refresh while the phone is on and running.
Any ideas?
Did you try to restart the power manager?
Could you show me how?
I’ve noticed this behavior, too.
Check upower first
purism@pureos:~$ upower -d
Device: /org/freedesktop/UPower/devices/battery_axp20x_battery
native-path: axp20x-battery
power supply: yes
updated: Tue Jan 5 16:58:51 2021 (29 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: none
energy: 0 Wh
energy-empty: 0 Wh
energy-full: 0 Wh
energy-full-design: 0 Wh
energy-rate: 0 W
voltage: 4.174 V
percentage: 87%
capacity: 100%
icon-name: 'battery-full-symbolic'
and then actual battery sensor
purism@pureos:~$ cat /sys/class/power_supply/axp20x-battery/capacity
87
and if they match there’s little you can do. Note that this is for pinephone, on L5 battery will be named differently.
Yes, they match
purism@pureos:~$ upower -d
Device: /org/freedesktop/UPower/devices/battery_max170xx_battery
native-path: max170xx_battery
power supply: yes
updated: Tue 05 Jan 2021 09:35:02 AM PST (70 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: none
energy: 17.7373 Wh
energy-empty: 0 Wh
energy-full: 29.6941 Wh
energy-full-design: 29.6941 Wh
energy-rate: 3.07664 W
voltage: 3.67188 V
time to empty: 5.8 hours
percentage: 59%
temperature: 30.5 degrees C
capacity: 100%
technology: lithium-ion
icon-name: ‘battery-good-symbolic’
History (charge):
1609868102 0.000 unknown
History (rate):
1609868102 0.000 unknown
purism@pureos:~$ cat /sys/class/power_supply/max170xx-battery/capacity
cat: /sys/class/power_supply/max170xx-battery/capacity: No such file or directory
Pay attention to the underscore, it’s
cat /sys/class/power_supply/max170xx_battery/capacity
not max170xx-battery
I don’t have an L5 yet, but does sudo systemctl restart upower
do anything for you?
Maybe it is time to change the battery meter fluid?
Lights my screen up and makes a couple of clicking noises. (I was ssh’ing it.) The meter readings didn’t change, though.
Yes, a couple of clicking noises. The same sound you hear when you plug the charger. But I confirm: not changes on battery level.
Do you think that sound comes from the speakers? My PP makes a sound on plugging in the charger, too. It comes from the speakers to indicate charging or the plugin of the cable. Other than the speakers I would expect noises to be caused by mechanical parts. And there are basically no mechanical parts in these phones, despite HKSs.
Yes, it comes from the speakers. That is something inherited from GNOME, and if you use GNOME on a laptop you should hear the same noise when you plug in the charger
That noise is expected, it indicates a charger was connected/disconnected. And when you restart: upower
you get that noise as well.
Funny…I don’t think I’ve ever heard the clicking sound when I plugged the phone in. (I usually turn it off first, but not always.)
Correction: today after charging the battery until the red LED went out, the battery level was 52%. After restarting power manager it became 99%. I’ll do more testing.
Did you check before restart that /sys/class/…/capacity was matching to that 52%? I.e. was it upowerd just getting value out of blue or its restart actually nudged pmic driver to re-read the gauge?
No I didn’t, but I’ll check shortly.
I’ve noticed that it gives a better estimate after a reboot
That’s an effect of several wrong-doings in the battery gauge kernel driver, refreshing the gauge won’t help there (part of the problem is that it gets reset after each boot after all).
However! A kernel update that finally makes it behave as intended has just entered amber-phone-staging and should migrate to production repos in a week
To answer the stated question (even if it doesn’t answer the actual problem): the gauge calibration data should get reset after taking the battery off.