mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 08:58:07 +02:00
openbsd: handle case where minutes_left might be negative
might not be useful since apm_fd is accessed through the singleton.. Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
parent
3dfc0598f8
commit
7cd8465811
1 changed files with 2 additions and 2 deletions
|
|
@ -322,8 +322,8 @@ up_backend_update_battery_state(UpDevice* device)
|
|||
if (a.ac_state == APM_AC_ON)
|
||||
new_state = UP_DEVICE_STATE_CHARGING;
|
||||
|
||||
// zero out new_time_to empty if we're not discharging
|
||||
new_time_to_empty = (new_state == UP_DEVICE_STATE_DISCHARGING ? a.minutes_left : 0);
|
||||
// zero out new_time_to empty if we're not discharging or minutes_left is negative
|
||||
new_time_to_empty = (new_state == UP_DEVICE_STATE_DISCHARGING && a.minutes_left > 0 ? a.minutes_left : 0);
|
||||
|
||||
if (cur_state != new_state ||
|
||||
percentage != (gdouble) a.battery_life ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue