Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[powerkey] Do not reset p-sensor override when sensor state is unknown
The emergency proximity sensor override is supposed to works so that
pressing power key 3 times (by default) while sensor is stuck forces the
effective senśor state to OPEN. Resetting the counter while sensor state is
not CLOSED can make it impossible to use the feature for recovering from
malfunctioning on-demand activation getting stuck to UNDEF state.

Reset the counter only when sensor in in OPEN state.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Mar 15, 2019
1 parent 2140c42 commit 0924e52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion powerkey.c
Expand Up @@ -676,7 +676,7 @@ pwrkey_ps_override_evaluate(void)
}

/* If neither sensor is not covered, just reset the counter */
if( proximity_sensor_actual != COVER_CLOSED &&
if( proximity_sensor_actual == COVER_OPEN &&
lid_sensor_filtered != COVER_CLOSED ) {
t_last = 0, count = 0;
goto EXIT;
Expand Down

0 comments on commit 0924e52

Please sign in to comment.