diff options
author | Benjamin Berg <bberg@redhat.com> | 2022-06-14 17:02:45 +0200 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2022-06-14 17:02:45 +0200 |
commit | ce2478716517df002175d0c4f57c057a0977ccb3 (patch) | |
tree | bedbfdf8e6be680bc2217a34c142e0166b447c76 /src | |
parent | a78ee6039054770b466749f8ec4bfbe4c278d697 (diff) |
supply: Use percentage to guess empty STATE
Using energy is broken as the value might be zero if it is not provided.
However, either energy or percentage ("capacity") should have been read
from the sysfs. And, in both cases the percentage should reflect
something reasonable.
Related: #146
Diffstat (limited to 'src')
-rw-r--r-- | src/linux/up-device-supply.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index f20ce07..ffa4ad6 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -676,7 +676,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply, state = UP_DEVICE_STATE_FULLY_CHARGED; /* if empty, and BIOS does not know what to do */ - if (state == UP_DEVICE_STATE_UNKNOWN && energy < 0.01) { + if (state == UP_DEVICE_STATE_UNKNOWN && percentage < 1) { g_warning ("Setting %s state empty as unknown and very low", g_udev_device_get_sysfs_path (native)); state = UP_DEVICE_STATE_EMPTY; |