summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2020-09-17 12:28:12 +1000
committerCommit Bot <commit-bot@chromium.org>2020-09-18 03:23:02 +0000
commit598e0cb0fc7bd0f48776205f37fecd1181212c70 (patch)
treecf5a4544eb721d1dc3814ac82d274985ef75e0f7
parenta345cfc8ca330248e84250b6b962e1a6670bc3f2 (diff)
downloadchrome-ec-598e0cb0fc7bd0f48776205f37fecd1181212c70.tar.gz
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 <amcrae@google.com> Change-Id: I74c2eafaeccd491eb42ebb692ea22495c235a1e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2413818 Commit-Queue: Andrew McRae <amcrae@chromium.org> Reviewed-by: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
-rw-r--r--common/button.c11
1 files 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],