diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2020-06-03 23:06:35 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-14 21:36:00 +0000 |
commit | 968d1a154be811a6619f54c59003707998005aac (patch) | |
tree | e93863e7b8c9476cc8fbbb24f087f0de6e97b659 | |
parent | c34f2385f86e31a7ea078b3590d85c5a288073e5 (diff) | |
download | chrome-ec-968d1a154be811a6619f54c59003707998005aac.tar.gz |
common: motion_sense: Add on-body/off-body detection
This CL adds the interface for on-body/off-body detection
- state: 1 : on-body, 0 : off-body.
When activity is enabled, EC sends an event when the body detection
changes. The host can now query the current value of the activity.
BRANCH=None
BUG=b:123434029
TEST=compile
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I007a5fe6c9030ab5c0c47995db3498751218d9c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2229803
-rw-r--r-- | include/ec_commands.h | 19 | ||||
-rw-r--r-- | util/ectool.c | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index b9ef3f08ff..b1b583abdb 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2530,6 +2530,12 @@ enum motionsense_command { */ MOTIONSENSE_CMD_ONLINE_CALIB_READ = 19, + /* + * Activity management + * Retrieve current status of given activity. + */ + MOTIONSENSE_CMD_GET_ACTIVITY = 20, + /* Number of motionsense sub-commands. */ MOTIONSENSE_NUM_CMDS }; @@ -2648,6 +2654,7 @@ enum motionsensor_activity { MOTIONSENSE_ACTIVITY_SIG_MOTION = 1, MOTIONSENSE_ACTIVITY_DOUBLE_TAP = 2, MOTIONSENSE_ACTIVITY_ORIENTATION = 3, + MOTIONSENSE_ACTIVITY_BODY_DETECTION = 4, }; struct ec_motion_sense_activity { @@ -2832,6 +2839,7 @@ struct ec_params_motion_sense { uint32_t max_data_vector; } fifo_read; + /* Used for MOTIONSENSE_CMD_SET_ACTIVITY */ struct ec_motion_sense_activity set_activity; /* Used for MOTIONSENSE_CMD_LID_ANGLE */ @@ -2886,6 +2894,13 @@ struct ec_params_motion_sense { uint8_t sensor_num; } online_calib_read; + /* + * Used for MOTIONSENSE_CMD_GET_ACTIVITY. + */ + struct __ec_todo_unpacked { + uint8_t sensor_num; + uint8_t activity; /* enum motionsensor_activity */ + } get_activity; }; } __ec_todo_packed; @@ -3037,6 +3052,10 @@ struct ec_response_motion_sense { uint16_t hys_degree; } tablet_mode_threshold; + /* USED for MOTIONSENSE_CMD_GET_ACTIVITY. */ + struct __ec_todo_unpacked { + uint8_t state; + } get_activity; }; } __ec_todo_packed; diff --git a/util/ectool.c b/util/ectool.c index 17b72b836c..5111d794b2 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -4860,6 +4860,7 @@ static const struct { ST_BOTH_SIZES(tablet_mode_threshold), ST_BOTH_SIZES(sensor_scale), ST_BOTH_SIZES(online_calib_read), + ST_BOTH_SIZES(get_activity), }; BUILD_ASSERT(ARRAY_SIZE(ms_command_sizes) == MOTIONSENSE_NUM_CMDS); |