diff options
author | Vic Yang <victoryang@chromium.org> | 2013-02-19 13:33:33 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-02-19 23:01:10 -0800 |
commit | aab9accfce10e70197729afd07451229ac8a178d (patch) | |
tree | 5d00eed06499ff87c1b22985fc10696cd8c03c25 /util | |
parent | 2e64bed323809ff3cdfe264401eb7c1747b80b9e (diff) | |
download | chrome-ec-aab9accfce10e70197729afd07451229ac8a178d.tar.gz |
spring: Add host command to read power info
Getting voltage and current can be handy when verifying hardware design.
Let's add host command to do this.
BUG=chrome-os-partner:17880
TEST=Manual on Spring
BRANCH=none
Change-Id: I4d4f6a42a9d0f917292d092e132ccd9ce3367fd6
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43508
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c index 253dc2ef27..3804170b8d 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -100,6 +100,8 @@ const char help_str[] = " Various lightbar control commands\n" " port80flood\n" " Rapidly write bytes to port 80\n" + " powerinfo\n" + " Prints power-related information\n" " pstoreinfo\n" " Prints information on the EC host persistent storage\n" " pstoreread <offset> <size> <outfile>\n" @@ -1501,6 +1503,24 @@ int cmd_kbpress(int argc, char *argv[]) } +int cmd_power_info(int argc, char *argv[]) +{ + struct ec_response_power_info r; + int rv; + + rv = ec_command(EC_CMD_POWER_INFO, 0, NULL, 0, &r, sizeof(r)); + if (rv < 0) + return rv; + + printf("AC Voltage: %d mV\n", r.voltage_ac); + printf("System Voltage: %d mV\n", r.voltage_system); + printf("System Current: %d mA\n", r.current_system); + printf("USB Device Type: 0x%x\n", r.usb_dev_type); + printf("USB Current Limit: %d mA\n", r.usb_current_limit); + return 0; +} + + int cmd_pstore_info(int argc, char *argv[]) { struct ec_response_pstore_info r; @@ -2748,6 +2768,7 @@ const struct command commands[] = { {"lightbar", cmd_lightbar}, {"keyconfig", cmd_keyconfig}, {"keyscan", cmd_keyscan}, + {"powerinfo", cmd_power_info}, {"pstoreinfo", cmd_pstore_info}, {"pstoreread", cmd_pstore_read}, {"pstorewrite", cmd_pstore_write}, |