summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-04-08 10:42:05 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-10 22:23:32 +0000
commit335ad0c397f61d81d7fb5db8e3fb24e9bc089a2d (patch)
treec9aeb44894f68aebcf2ee1c4fb0c29aa17a24279 /util
parent3505d8972c647a708da3e2b29ba69a59094aa05d (diff)
downloadchrome-ec-335ad0c397f61d81d7fb5db8e3fb24e9bc089a2d.tar.gz
accel: Add arg to ectool motionsense to print sensor active flag.
Added arg to ectool motionsense command to print the active flag. BUG=none BRANCH=rambi TEST=Tested ectool command on glimmer Change-Id: I4066302d388857b2646a4ee778aa7f671e9b7d2a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193630 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 6c09268ca19d7d3db497beff65a5db79f33657cb) Reviewed-on: https://chromium-review.googlesource.com/194082
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index af7b3f5c66..f8c1b13339 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -1710,6 +1710,7 @@ static int ms_help(const char *cmd)
{
printf("Usage:\n");
printf(" %s - dump all motion data\n", cmd);
+ printf(" %s active - print active flag\n", cmd);
printf(" %s info NUM - print sensor info\n", cmd);
printf(" %s ec_rate [RATE_MS] - set/get sample rate\n", cmd);
printf(" %s odr NUM [ODR [ROUNDUP]] - set/get sensor ODR\n", cmd);
@@ -1752,12 +1753,37 @@ static int cmd_motionsense(int argc, char **argv)
resp.dump.data[3*i+1],
resp.dump.data[3*i+2]);
else
+ /*
+ * Warning: the following string printed out
+ * is read by an autotest. Do not change string
+ * without consulting autotest for
+ * kernel_CrosECSysfsAccel.
+ */
printf("None\n");
}
return 0;
}
+ if (argc == 2 && !strcasecmp(argv[1], "active")) {
+ param.cmd = MOTIONSENSE_CMD_DUMP;
+ rv = ec_command(EC_CMD_MOTION_SENSE_CMD, 0,
+ &param, ms_command_sizes[param.cmd].insize,
+ &resp, ms_command_sizes[param.cmd].outsize);
+
+ /*
+ * Warning: the following strings printed out are read in an
+ * autotest. Do not change string without consulting autotest
+ * for kernel_CrosECSysfsAccel.
+ */
+ if (resp.dump.module_flags & MOTIONSENSE_MODULE_FLAG_ACTIVE)
+ printf("1\n");
+ else
+ printf("0\n");
+
+ return 0;
+ }
+
if (argc == 3 && !strcasecmp(argv[1], "info")) {
param.cmd = MOTIONSENSE_CMD_INFO;