New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 839192 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

ec: notify_host_of_low_battery() is broken

Project Member Reported by philipchen@chromium.org, May 3 2018

Issue description

In common/charge_state_v2.c, here is how charger_task sends host event EC_HOST_EVENT_BATTERY_LOW or EC_HOST_EVENT_BATTERY_CRITICAL:

if (curr.batt.state_of_charge <= BATTERY_LEVEL_LOW && 
    prev_charge > BATTERY_LEVEL_LOW)
    host_set_single_event(EC_HOST_EVENT_BATTERY_LOW);

if (curr.batt.state_of_charge <= BATTERY_LEVEL_CRITICAL &&
    prev_charge > BATTERY_LEVEL_CRITICAL)
    host_set_single_event(EC_HOST_EVENT_BATTERY_CRITICAL);

Note that prev_charge is initialized as -1.
So if we do a hard reset when SOC is already lower than BATTERY_LEVEL_CRITICAL, EC wouldn't send EC_HOST_EVENT_BATTERY_CRITICAL.
The case for BATTERY_LEVEL_LOW is similarly broken.

Well, I don't see any kernel code handles
EC_HOST_EVENT_BATTERY_LOW or EC_HOST_EVENT_BATTERY_CRITICAL anyway.
But it's still good to fix this.
 
Labels: OS-Chrome
Owner: philipchen@chromium.org
Status: Assigned (was: Untriaged)
This bug has an owner, thus, it's been triaged. Changing status to "assigned".

Sign in to add a comment