diff options
author | Aseda Aboagye <aaboagye@google.com> | 2015-09-24 15:32:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-26 07:12:16 -0700 |
commit | 9d9f020aaf19267e767c48dcf96db1319e3669ce (patch) | |
tree | b3168db8b713a0d2457b16fd1760b38baf6c0c34 /util | |
parent | 747056ec93b7d55a117be812a5d77452b0851086 (diff) | |
download | chrome-ec-9d9f020aaf19267e767c48dcf96db1319e3669ce.tar.gz |
ectool: Add "hibdelay" command.
This commit adds the "hibdelay" command which will set the time before
the EC hibernates.
BUG=chrome-os-partner:45608
BUG=chrome-os-partner:44831
BRANCH=None
TEST=Build and flash samus EC with hibernation delay host command
added. Use ectool to set the hibernation delay and verify that the
hibernation delay was changed.
CQ-DEPEND=302197
Change-Id: I91141ee48a648c1052f0a3930a810ea4f551e0a4
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/302198
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c index 0617559220..722ba32cb5 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -117,6 +117,8 @@ const char help_str[] = " Configure or start/stop the hang detect timer\n" " hello\n" " Checks for basic communication with EC\n" + " hibdelay [sec]\n" + " Set the delay before going into hibernation\n" " kbpress\n" " Simulate key press\n" " i2cread\n" @@ -330,6 +332,36 @@ int cmd_hello(int argc, char *argv[]) return 0; } +int cmd_hibdelay(int argc, char *argv[]) +{ + struct ec_params_hibernation_delay p; + struct ec_response_hibernation_delay r; + char *e; + int rv; + + if (argc < 2) { + p.seconds = 0; /* Just read the current settings. */ + } else { + p.seconds = strtoul(argv[1], &e, 0); + if (e && *e) { + fprintf(stderr, "invalid number\n"); + return -1; + } + } + + rv = ec_command(EC_CMD_HIBERNATION_DELAY, 0, &p, sizeof(p), + &r, sizeof(r)); + if (rv < 0) { + fprintf(stderr, "err: rv=%d\n", rv); + return -1; + } + + printf("Hibernation delay: %u s\n", r.hibernate_delay); + printf("Time G3: %u s\n", r.time_g3); + printf("Time left: %u s\n", r.time_remaining); + return 0; +} + int cmd_test(int argc, char *argv[]) { struct ec_params_test_protocol p = { @@ -6463,6 +6495,7 @@ const struct command commands[] = { {"gpioset", cmd_gpio_set}, {"hangdetect", cmd_hang_detect}, {"hello", cmd_hello}, + {"hibdelay", cmd_hibdelay}, {"kbpress", cmd_kbpress}, {"i2cread", cmd_i2c_read}, {"i2cwrite", cmd_i2c_write}, |