Skip to content

Commit

Permalink
*WIP*
Browse files Browse the repository at this point in the history
  • Loading branch information
martyone committed Aug 16, 2022
1 parent 9bd6235 commit ae89907
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/battery-udev.c
Expand Up @@ -1720,6 +1720,15 @@ udevdevice_evaluate_battery(udevdevice_t *self, mcebat_t *mcebat)
mcebat->battery_status = BATTERY_STATUS_OK;
if( self->udd_full && capacity >= BATTERY_CAPACITY_FULL )
mcebat->battery_status = BATTERY_STATUS_FULL;
/* Some devices never report Full state */
else if ( capacity >= 100 ) {
mcebat->battery_status = BATTERY_STATUS_FULL;

if( !self->udd_full ) {
mce_log(LL_WARN, "assuming end of charging due to battery capacity 100%%");
self->udd_full = true;
}
}
else
self->udd_full = false;
}
Expand Down
3 changes: 3 additions & 0 deletions modules/charging.c
Expand Up @@ -480,6 +480,9 @@ static void mch_policy_set_charging_mode(charging_mode_t charging_mode)
mch_charging_mode = charging_mode;
mch_charging_mode_evaluated_with_cable_connected = FALSE;

/* Clear battery full seen */
mch_policy_set_battery_full(false);

mch_dbus_send_charging_mode(0);
mch_policy_evaluate_charging_state();

Expand Down

0 comments on commit ae89907

Please sign in to comment.