mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 16:58:07 +02:00
linux: up-device-supply-battery: Don't mark fully charged batteries as discharging
This commit addresses the changes from commit d7ff457784
by excluding fully charged batteries even if their current_now is
negative.
This commit is contained in:
parent
a86d2d059c
commit
ebcefcea55
1 changed files with 5 additions and 4 deletions
|
|
@ -304,11 +304,12 @@ up_device_supply_battery_refresh (UpDevice *device,
|
|||
/* For some battery solutions, for example axp20x-battery, the kernel reports
|
||||
* status = charging but the battery actually discharges when connecting a
|
||||
* charger. Upower reports the battery is "discharging" when current_now is
|
||||
* found and is a negative value.*/
|
||||
if (g_udev_device_get_sysfs_attr_as_double_uncached (native, "current_now") < 0.0)
|
||||
* found and is a negative value as long as the battery isn't fully charged.*/
|
||||
values.state = up_device_supply_get_state (native);
|
||||
|
||||
if (values.state != UP_DEVICE_STATE_FULLY_CHARGED &&
|
||||
g_udev_device_get_sysfs_attr_as_double_uncached (native, "current_now") < 0.0)
|
||||
values.state = UP_DEVICE_STATE_DISCHARGING;
|
||||
else
|
||||
values.state = up_device_supply_get_state (native);
|
||||
|
||||
values.temperature = g_udev_device_get_sysfs_attr_as_double_uncached (native, "temp") / 10.0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue