summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-02-24 12:55:03 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-02-26 00:38:31 +0000
commit2ecefeb0eb250a0f40dfb02fd1aca8b21d7dd2d6 (patch)
treeec6f5b5f415d0ee7ad3e6796bc8efed8b8aa59a9
parent4eddcbd748d9a798425ca3c8d92912695c5d62fa (diff)
downloadchrome-ec-2ecefeb0eb250a0f40dfb02fd1aca8b21d7dd2d6.tar.gz
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>
-rw-r--r--common/lightbar.c19
1 files changed, 14 insertions, 5 deletions
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);