From 335ad0c397f61d81d7fb5db8e3fb24e9bc089a2d Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Tue, 8 Apr 2014 10:42:05 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/193630 Reviewed-by: Bill Richardson (cherry picked from commit 6c09268ca19d7d3db497beff65a5db79f33657cb) Reviewed-on: https://chromium-review.googlesource.com/194082 --- util/ectool.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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, + ¶m, 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; -- cgit v1.2.1