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 <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187679
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Bill Richardson
2014-02-24 12:55:03 -08:00
committed by chrome-internal-fetch
parent 4eddcbd748
commit 2ecefeb0eb

View File

@@ -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);