summaryrefslogtreecommitdiff
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-08 22:39:03 +0000
commit6c09268ca19d7d3db497beff65a5db79f33657cb (patch)
treeec0c253f771d35d3f36fe141fa22ec4f6128c9db
parent59d7f84df88243798ec78fa98784fc302fe3bedf (diff)
downloadchrome-ec-6c09268ca19d7d3db497beff65a5db79f33657cb.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>
-rw-r--r--util/ectool.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 3872241217..62f2799453 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -1677,6 +1677,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);
@@ -1719,12 +1720,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;