summaryrefslogtreecommitdiff
path: root/util/ectool.c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2022-03-28 12:52:36 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-30 22:43:19 +0000
commit9c78cd31c0db7d9997646812f7cea663e3d9ca63 (patch)
tree43b974d16ca16c815dc8700cc195d906ea19106c /util/ectool.c
parent057ac6a5794753a775e52f63c329ef7ecc3e088b (diff)
downloadchrome-ec-9c78cd31c0db7d9997646812f7cea663e3d9ca63.tar.gz
RGBKBD: Add EC_CMD_RGBKBD command
Host programs call EC_CMD_RGBKBD to set or get data, config, etc. of an RGB keyboard. This patch adds EC_RGBKBD_SUBCMD_CLEAR sub-command. localhost ~ # ectool --device 18d1:5022 rgbkbd clear 0xff0000 BUG=b:223465912 BRANCH=None TEST=Prism/Vell. See above. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I20013a2b3c7b831ce0f8dcee5833c9c4017795da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3558056 Reviewed-by: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'util/ectool.c')
-rw-r--r--util/ectool.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/util/ectool.c b/util/ectool.c
index d17ba521c7..479e7096a9 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -1293,8 +1293,11 @@ static void cmd_rgbkbd_help(char *cmd)
fprintf(stderr,
" Usage1: %s <key> <RGB>\n"
" Set the color of <key> to <RGB>.\n"
+ "\n"
+ " Usage2: %s clear <RGB>\n"
+ " Set the color of all keys to <RGB>.\n"
"\n",
- cmd);
+ cmd, cmd);
}
static int cmd_rgbkbd_parse_rgb_text(const char *text, struct rgb_s *color)
@@ -1363,7 +1366,16 @@ static int cmd_rgbkbd(int argc, char *argv[])
return -1;
}
- if (2 < argc) {
+ if (argc == 3 && !strcasecmp(argv[1], "clear")) {
+ /* Usage 2 */
+ struct ec_params_rgbkbd p;
+
+ p.subcmd = EC_RGBKBD_SUBCMD_CLEAR;
+ if (cmd_rgbkbd_parse_rgb_text(argv[2], &p.color))
+ return -1;
+
+ rv = ec_command(EC_CMD_RGBKBD, 0, &p, sizeof(p), NULL, 0);
+ } else if (2 < argc) {
/* Usage 1 */
rv = cmd_rgbkbd_set_color(argc, argv);
}