summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChromeOS Developer <dparker@chromium.org>2013-11-12 11:12:00 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-11-13 05:19:09 +0000
commit9a568cc1549f60d1f532ae8429af635da4b4502a (patch)
tree02068a733366388346ef8d08c81d86288c42a179
parent034e06febf0e3ed1daf55f66f82e7c6c804bcb3b (diff)
downloadchrome-ec-9a568cc1549f60d1f532ae8429af635da4b4502a.tar.gz
Add boardversion command to ectool
BRANCH=none BUG=chromium:318342 TEST=Run "ectool boardversion" on device with and without support for board ID. Note, boards without support will return an error. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Ib7599570c84a7ed5cf70ce9d8336467785b35569 Reviewed-on: https://chromium-review.googlesource.com/176543
-rw-r--r--common/system.c2
-rw-r--r--util/ectool.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/common/system.c b/common/system.c
index b09d804891..6e1c8c99ac 100644
--- a/common/system.c
+++ b/common/system.c
@@ -908,6 +908,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CHIP_INFO,
host_command_get_chip_info,
EC_VER_MASK(0));
+#ifdef CONFIG_BOARD_VERSION
int host_command_get_board_version(struct host_cmd_handler_args *args)
{
struct ec_response_board_version *r = args->response;
@@ -921,6 +922,7 @@ int host_command_get_board_version(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_GET_BOARD_VERSION,
host_command_get_board_version,
EC_VER_MASK(0));
+#endif
int host_command_vbnvcontext(struct host_cmd_handler_args *args)
{
diff --git a/util/ectool.c b/util/ectool.c
index 23244e54fb..8bb079c818 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -36,6 +36,8 @@ const char help_str[] =
" Prints battery info\n"
" batterycutoff\n"
" Cut off battery output power\n"
+ " boardversion\n"
+ " Prints the board version\n"
" chargecurrentlimit\n"
" Set the maximum battery charging current\n"
" chargedump\n"
@@ -2856,6 +2858,20 @@ int cmd_battery_cut_off(int argc, char *argv[])
return rv;
}
+int cmd_board_version(int argc, char *argv[])
+{
+ struct ec_response_board_version response;
+ int rv;
+
+ rv = ec_command(EC_CMD_GET_BOARD_VERSION, 0, NULL, 0, &response,
+ sizeof(response));
+ if (rv < 0)
+ return rv;
+
+ printf("%d\n", response.board_version);
+ return rv;
+}
+
int cmd_chipinfo(int argc, char *argv[])
{
struct ec_response_get_chip_info info;
@@ -3356,6 +3372,7 @@ const struct command commands[] = {
{"backlight", cmd_lcd_backlight},
{"battery", cmd_battery},
{"batterycutoff", cmd_battery_cut_off},
+ {"boardversion", cmd_board_version},
{"chargecurrentlimit", cmd_charge_current_limit},
{"chargedump", cmd_charge_dump},
{"chargecontrol", cmd_charge_control},