mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Fix leaving keyboard scanning disabled on brief power button press
If the power button is pressed for a shorter period than the debounce timeout, then the debounced state never changes. This was causing the power button state machine to disable scanning (in the interrupt handler) but never re-enable it (in the deferred handler). Easy fix; just re-enable based on whether the current state is released, not whether the debounced state is transitioning to released. BUG=chrome-os-partner:21772 BRANCH=all (falco, pit, etc.) TEST=type on console. briefly flick power button. type more; should work. Change-Id: I9723a6aa10f122fcee62702b85ce7981b1c8103a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65238 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
committed by
ChromeBot
parent
100cace7ab
commit
ffed16cae4
@@ -67,6 +67,10 @@ static void power_button_change_deferred(void)
|
||||
{
|
||||
const int new_pressed = raw_power_button_pressed();
|
||||
|
||||
/* Re-enable keyboard scanning if power button is no longer pressed */
|
||||
if (!new_pressed)
|
||||
keyboard_scan_enable(1);
|
||||
|
||||
/* If power button hasn't changed state, nothing to do */
|
||||
if (new_pressed == debounced_power_pressed)
|
||||
return;
|
||||
@@ -75,10 +79,6 @@ static void power_button_change_deferred(void)
|
||||
|
||||
CPRINTF("[%T power button %s]\n", new_pressed ? "pressed" : "released");
|
||||
|
||||
/* Re-enable keyboard scanning if power button is no longer pressed */
|
||||
if (!new_pressed)
|
||||
keyboard_scan_enable(1);
|
||||
|
||||
/* Call hooks */
|
||||
hook_notify(HOOK_POWER_BUTTON_CHANGE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user