diff options
author | Ching-Kang Yen <chingkang@chromium.org> | 2020-12-09 17:28:03 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-11 03:09:10 +0000 |
commit | b5b267fbfe2493c38f920f610de4d79d2c6f50ee (patch) | |
tree | f04385fa9947686cb7c43fa265c794564983058a /common | |
parent | ea56421c9b616669898b6cea3a57fc824e1e4340 (diff) | |
download | chrome-ec-b5b267fbfe2493c38f920f610de4d79d2c6f50ee.tar.gz |
ec_commands: add struct ec_response_activity_data
Add struct ec_response_activity_data to handle activity data in
include/ec_commands.h.
BRANCH=None
BUG=b:169374265
TEST=make buildall
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Change-Id: I5f40d45d656ae91acc6e9364261c548f302383ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581708
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/body_detection.c | 6 | ||||
-rw-r--r-- | common/motion_sense.c | 19 |
2 files changed, 16 insertions, 9 deletions
diff --git a/common/body_detection.c b/common/body_detection.c index ed74a2545d..34257dd633 100644 --- a/common/body_detection.c +++ b/common/body_detection.c @@ -98,8 +98,10 @@ void body_detect_change_state(enum body_detect_states state, bool spoof) if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) { struct ec_response_motion_sensor_data vector = { .flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP, - .activity = MOTIONSENSE_ACTIVITY_BODY_DETECTION, - .state = state, + .activity_data = { + .activity = MOTIONSENSE_ACTIVITY_BODY_DETECTION, + .state = state, + }, .sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID, }; motion_sense_fifo_stage_data(&vector, NULL, 0, diff --git a/common/motion_sense.c b/common/motion_sense.c index ea310a4f89..d4e1cbdc10 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -771,8 +771,9 @@ static void check_and_queue_gestures(uint32_t *event) vector.flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP; else vector.flags = 0; - vector.activity = MOTIONSENSE_ACTIVITY_DOUBLE_TAP; - vector.state = 1; /* triggered */ + vector.activity_data.activity = + MOTIONSENSE_ACTIVITY_DOUBLE_TAP; + vector.activity_data.state = 1 /* triggered */; vector.sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID; motion_sense_fifo_stage_data(&vector, NULL, 0, __hw_clock_source_read()); @@ -790,8 +791,9 @@ static void check_and_queue_gestures(uint32_t *event) /* Send events to the FIFO */ vector.flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP; - vector.activity = MOTIONSENSE_ACTIVITY_SIG_MOTION; - vector.state = 1; /* triggered */ + vector.activity_data.activity = + MOTIONSENSE_ACTIVITY_SIG_MOTION; + vector.activity_data.state = 1 /* triggered */; vector.sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID; motion_sense_fifo_stage_data(&vector, NULL, 0, __hw_clock_source_read()); @@ -812,7 +814,8 @@ static void check_and_queue_gestures(uint32_t *event) (sensor->state == SENSOR_INITIALIZED)) { struct ec_response_motion_sensor_data vector = { .flags = 0, - .activity = MOTIONSENSE_ACTIVITY_ORIENTATION, + .activity_data.activity = + MOTIONSENSE_ACTIVITY_ORIENTATION, .sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID, }; @@ -821,7 +824,8 @@ static void check_and_queue_gestures(uint32_t *event) (*motion_orientation_ptr(sensor) != MOTIONSENSE_ORIENTATION_UNKNOWN)) { motion_orientation_update(sensor); - vector.state = *motion_orientation_ptr(sensor); + vector.activity_data.state = + *motion_orientation_ptr(sensor); motion_sense_fifo_stage_data(&vector, NULL, 0, __hw_clock_source_read()); motion_sense_fifo_commit_data(); @@ -833,7 +837,8 @@ static void check_and_queue_gestures(uint32_t *event) "Inv_Landscape", "Unknown" }; - CPRINTS(mode[vector.state]); + CPRINTS(mode[ + vector.activity_data.state]); } } mutex_unlock(sensor->mutex); |