Set hours remaining for charged and plugged in devices to default 0 or something else value
On my laptop, when I have it fully charged and connected to the power supply, if I go to Power Manager → Devices, I see the following:
As, we can see, it's showing 1992 hours, which is a weird number to have, and it confused me to what this value is.
Digging around the source code, I found out we use libupower-glib
to receive this value, as this is calculated by upower
.
As, verified by upower -i /org/freedesktop/UPower/devices/battery_BAT0
native-path: BAT0
vendor: SMP
model: DELL VN3N047
serial: 6160
power supply: yes
updated: Thu 08 Aug 2024 09:00:59 AM +0545 (17 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: fully-charged
warning-level: none
energy: 29.4816 Wh
energy-empty: 0 Wh
energy-full: 29.4816 Wh
energy-full-design: 41.44 Wh
energy-rate: 0.0148 W
voltage: 16.493 V
charge-cycles: N/A
time to empty: 83.0 days
percentage: 100%
capacity: 71.1429%
technology: lithium-ion
icon-name: 'battery-full-charged-symbolic'
From the value received from time to empty
we are converting it to hours and that's why the value 1992 hours (from 83.0 days).
I wanted to understand whether this is a bug on the upower
side of things or if this is a desired output. So, I asked there.
From there, I understood that my battery was slowly discharging, and the power source would start charging it, after it reached some threshold value. It was calculating if my battery didn't receive any power and with the small discharge current, it would take 83.0 days to empty.
This makes sense from the upower
side of things, but on the UI side of things in Power Manager, we shouldn't show these hours, as, it confuses more than it helps. Either we must set, this to 0 hours remaining
or don't show it at all.
On the plugin side of things, where we have a new change to show 100% - 0:00
, we can reset the value to 0:00
if the battery is charged and power supply is being provided.
Comments, @Tamaranch?