From 598e0cb0fc7bd0f48776205f37fecd1181212c70 Mon Sep 17 00:00:00 2001 From: Andrew McRae Date: Thu, 17 Sep 2020 12:28:12 +1000 Subject: Allow both dedicated recovery button and volume buttons Allow both a dedicated recovery button and volume buttons, and prefer the dedicated recovery button over the volume buttons for entering recovery mode. BUG=b:168752837 TEST=Build on dooly BRANCH=none Signed-off-by: Andrew McRae Change-Id: I74c2eafaeccd491eb42ebb692ea22495c235a1e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2413818 Commit-Queue: Andrew McRae Reviewed-by: Andrew McRae Tested-by: Andrew McRae --- common/button.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/button.c b/common/button.c index 46971321cf..5e84256f91 100644 --- a/common/button.c +++ b/common/button.c @@ -817,10 +817,6 @@ DECLARE_HOOK(HOOK_TICK, debug_led_tick, HOOK_PRIO_DEFAULT); #endif /* !CONFIG_DEDICATED_RECOVERY_BUTTON */ #endif /* CONFIG_EMULATED_SYSRQ */ -#if defined(CONFIG_VOLUME_BUTTONS) && defined(CONFIG_DEDICATED_RECOVERY_BUTTON) -#error "A dedicated recovery button is not needed if you have volume buttons." -#endif /* defined(CONFIG_VOLUME_BUTTONS && CONFIG_DEDICATED_RECOVERY_BUTTON) */ - #ifndef CONFIG_BUTTONS_RUNTIME_CONFIG const struct button_config buttons[BUTTON_COUNT] = { #else @@ -843,7 +839,8 @@ struct button_config buttons[BUTTON_COUNT] = { .flags = 0, }, -#elif defined(CONFIG_DEDICATED_RECOVERY_BUTTON) +#endif +#if defined(CONFIG_DEDICATED_RECOVERY_BUTTON) [BUTTON_RECOVERY] = { .name = "Recovery", .type = KEYBOARD_BUTTON_RECOVERY, @@ -864,6 +861,10 @@ struct button_config buttons[BUTTON_COUNT] = { }; #ifdef CONFIG_BUTTON_TRIGGERED_RECOVERY +/* + * Prefer the dedicated recovery button over the volume buttons if + * both are present. + */ const struct button_config *recovery_buttons[] = { #ifdef CONFIG_DEDICATED_RECOVERY_BUTTON &buttons[BUTTON_RECOVERY], -- cgit v1.2.1