summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2016-10-10 14:03:48 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-10-11 01:48:21 -0700
commit6abbb636393ddbb504d72dab5377a8a8dfe79482 (patch)
tree5a40be76109a39fd9eaf463847215f214aeada3a /board/cr50
parentbc34c98edd0e303617ce0dae7b283b18d290b0e7 (diff)
downloadchrome-ec-6abbb636393ddbb504d72dab5377a8a8dfe79482.tar.gz
cr50: add press and release options to powerbtn command
This change adds options to the powerbtn console command to press and release the power button. BUG=chrome-os-partner:58123 BRANCH=none TEST=manual 'powerbtn press' force a power button press 'powerbtn release' release the power button. This will not override the signal if the button is physically pressed. Change-Id: I52631d30dbae874ba6637f728cb6e435cb626e12 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/396207 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'board/cr50')
-rw-r--r--board/cr50/rdd.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c
index 4c67b5f1d2..49bb0297d0 100644
--- a/board/cr50/rdd.c
+++ b/board/cr50/rdd.c
@@ -333,16 +333,34 @@ static int command_powerbtn(int argc, char **argv)
char *e;
int ms = 200;
- if (argc == 2) {
- ms = strtoi(argv[1], &e, 0);
- if (*e)
+ if (argc > 1) {
+ if (!strcasecmp("pulse", argv[1])) {
+ if (argc == 3) {
+ ms = strtoi(argv[2], &e, 0);
+ if (*e)
+ return EC_ERROR_PARAM2;
+ }
+
+ ccprintf("Force %dms power button press\n", ms);
+
+ rbox_powerbtn_press();
+ msleep(ms);
+ rbox_powerbtn_release();
+ } else if (!strcasecmp("press", argv[1])) {
+ rbox_powerbtn_press();
+ } else if (!strcasecmp("release", argv[1])) {
+ rbox_powerbtn_release();
+ } else
return EC_ERROR_PARAM1;
}
- ccprintf("Simulating %dms power button press\n", ms);
- rbox_press_power_btn(ms);
+ ccprintf("powerbtn: %s\n",
+ rbox_powerbtn_override_is_enabled() ? "forced press" :
+ rbox_powerbtn_is_pressed() ? "pressed\n" : "released\n");
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(powerbtn, command_powerbtn,
- "ms",
- "Simulate a power button press");
+ "[pulse [ms] | press | release]",
+ "get/set the state of the power button");
+
+