diff options
-rw-r--r-- | util/ectool.c | 26 |
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, + ¶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; |