summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-08-20 12:47:32 -0700
committerGerrit <chrome-bot@google.com>2012-08-20 15:44:50 -0700
commitede77d7cac6a9730f706cb110da414748b45379e (patch)
tree75b1fb4650154518798a615835fc0bbfe8775113 /util
parentf229fabd8be499b45fbb801b1458f3dd2c58bd32 (diff)
downloadchrome-ec-ede77d7cac6a9730f706cb110da414748b45379e.tar.gz
Add "lightbar demo" mode for executive bikeshedding
I keep getting asked to build an EC image to manually control the lightbar patterns so that the Powers That Be can look at it. This change just makes it possible to turn that mode on and off for yourself. You'll need a root shell or the EC console to do it, though. BUG=chrome-os-partner:8039 BRANCH=link TEST=manual From the EC console, type lightbar demo 1 OR from the root shell run ectool lightbar demo 1 After that, these keys should change the lightbar appearance (transitions may be slow and subtle - that's intended): UP = battery is more fully charged DOWN = battery is less fully charged RIGHT = battery is charging LEFT = battery is discharging BRIGHT = increase lightbar brightness DIM = decrase lightbar brightness Note that this does not interfere with the normal function of any keys. It only adds some additional EC behavior. Change-Id: Ia1a9855188244d74b670f9dbfdf60e3ac0343460 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/30899
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c15
-rw-r--r--util/lbplay.c2
2 files changed, 17 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 81b9f2a133..0b6fa089e4 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -1044,6 +1044,8 @@ static const struct {
sizeof(((struct ec_params_lightbar_cmd *)0)->out.rgb) },
{ sizeof(((struct ec_params_lightbar_cmd *)0)->in.get_seq),
sizeof(((struct ec_params_lightbar_cmd *)0)->out.get_seq) },
+ { sizeof(((struct ec_params_lightbar_cmd *)0)->in.demo),
+ sizeof(((struct ec_params_lightbar_cmd *)0)->out.demo) },
};
static int lb_help(const char *cmd)
@@ -1059,6 +1061,7 @@ static int lb_help(const char *cmd)
printf(" %s CTRL REG VAL - set LED controller regs\n", cmd);
printf(" %s LED RED GREEN BLUE - set color manually"
" (LED=4 for all)\n", cmd);
+ printf(" %s demo 0|1 - turn demo mode on & off\n", cmd);
return 0;
}
@@ -1131,6 +1134,18 @@ static int cmd_lightbar(int argc, char **argv)
return lb_do_cmd(LIGHTBAR_CMD_BRIGHTNESS, &param);
}
+ if (argc == 3 && !strcasecmp(argv[1], "demo")) {
+ if (!strcasecmp(argv[2], "on") || argv[2][0] == '1')
+ param.in.demo.num = 1;
+ else if (!strcasecmp(argv[2], "off") || argv[2][0] == '0')
+ param.in.demo.num = 0;
+ else {
+ fprintf(stderr, "Invalid arg\n");
+ return -1;
+ }
+ return lb_do_cmd(LIGHTBAR_CMD_DEMO, &param);
+ }
+
if (argc >= 2 && !strcasecmp(argv[1], "seq")) {
char *e;
uint8_t num;
diff --git a/util/lbplay.c b/util/lbplay.c
index 9121623f91..9acabaddfb 100644
--- a/util/lbplay.c
+++ b/util/lbplay.c
@@ -40,6 +40,8 @@ static const struct {
sizeof(((struct ec_params_lightbar_cmd *)0)->out.rgb) },
{ sizeof(((struct ec_params_lightbar_cmd *)0)->in.get_seq),
sizeof(((struct ec_params_lightbar_cmd *)0)->out.get_seq) },
+ { sizeof(((struct ec_params_lightbar_cmd *)0)->in.demo),
+ sizeof(((struct ec_params_lightbar_cmd *)0)->out.demo) },
};