mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 16:58:07 +02:00
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
This commit is contained in:
parent
a78ee60390
commit
ce24787165
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue