From 2ecefeb0eb250a0f40dfb02fd1aca8b21d7dd2d6 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 24 Feb 2014 12:55:03 -0800 Subject: Add 'lightbar version' console command. There's already a host command, but no console command. We should add one. BUG=none BRANCH=ToT, Samus TEST=manual From the EC console, run lightbar version It should display the version number and flags value. Change-Id: Ide3517c0a71b5d78c4c4d849a952ccc1d908ea23 Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/187679 Reviewed-by: Randall Spangler --- common/lightbar.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/lightbar.c b/common/lightbar.c index 4f0f799957..6a24eab05d 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -21,11 +21,13 @@ #include "util.h" -/* The Link lightbar had no specific version. Any new ones should, especially - * if they are different in any way. If anything changes, update these. +/* + * The Link lightbar had no version command, so defaulted to zero. If we make + * any incompatible changes, update the version. Indicate any new features in + * the current version with flags bits. */ -#define LIGHTBAR_IMPLEMENTATION_VERSION 1 -#define LIGHTBAR_IMPLEMENTATION_FLAGS 0x00000000 +#define LIGHTBAR_IMPLEMENTATION_VERSION 0 +#define LIGHTBAR_IMPLEMENTATION_FLAGS 0 /* Console output macros */ #define CPUTS(outstr) cputs(CC_LIGHTBAR, outstr) @@ -1211,6 +1213,7 @@ static int help(const char *cmd) " (LED=4 for all)\n", cmd); ccprintf(" %s demo [0|1] - turn demo mode on & off\n", cmd); ccprintf(" %s params - show current params\n", cmd); + ccprintf(" %s version - show current version\n", cmd); return EC_SUCCESS; } #endif @@ -1323,6 +1326,12 @@ static int command_lightbar(int argc, char **argv) return EC_SUCCESS; } + if (!strcasecmp(argv[1], "version")) { + ccprintf("%d 0x%x\n", LIGHTBAR_IMPLEMENTATION_VERSION, + LIGHTBAR_IMPLEMENTATION_FLAGS); + return EC_SUCCESS; + } + if (!strcasecmp(argv[1], "brightness")) { char *e; if (argc > 2) { @@ -1392,6 +1401,6 @@ static int command_lightbar(int argc, char **argv) return EC_ERROR_INVAL; } DECLARE_CONSOLE_COMMAND(lightbar, command_lightbar, - "[on | off | init | brightness | seq] | [ctrl reg val]", + "[help | COMMAND [ARGS]]", "Get/set lightbar state", NULL); -- cgit v1.2.1