diff options
author | Tim Van Patten <timvp@google.com> | 2023-05-02 13:43:20 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-04 20:16:37 +0000 |
commit | 0d6bc55eaf6f6b725afd9ec43b45e6df4c2d94fa (patch) | |
tree | 87db415e348dc3048ba1c643029c275c56744de2 | |
parent | 25067066458e2a4c28e9b7185a07e4f7af7aacbd (diff) | |
download | chrome-ec-0d6bc55eaf6f6b725afd9ec43b45e6df4c2d94fa.tar.gz |
body_detection: Remove motion_sense_fifo_stage_data with NULL
There are several calls to motion_sense_fifo_stage_data() with the
|sensor| parameter set to NULL. However, motion_sense_fifo_stage_data()
requires a non-NULL value, and will crash otherwise.
Remove those calls, since they are (apparently) dead code. Otherwise,
the EC would be crashing whenever they are executed.
This allows enabling CONFIG_PLATFORM_EC_GESTURE_HOST_DETECTION in
test/drivers/prj.conf, to enable additional testing (which exposed this
bug).
BUG=b:259754018
TEST=emerge-skyrim chromeos-ec chromeos-zephyr -j
Change-Id: I8f641520e04e3f37a1f62e92eeaf1a03cfef07cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4499747
Tested-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Aaron Massey <aaronmassey@google.com>
-rw-r--r-- | common/body_detection.c | 13 | ||||
-rw-r--r-- | common/motion_sense.c | 41 |
2 files changed, 1 insertions, 53 deletions
diff --git a/common/body_detection.c b/common/body_detection.c index 646bc6d740..d16e83df00 100644 --- a/common/body_detection.c +++ b/common/body_detection.c @@ -102,19 +102,6 @@ void body_detect_change_state(enum body_detect_states state, bool spoof) { if (IS_ENABLED(CONFIG_ACCEL_SPOOF_MODE) && spoof_enable && !spoof) return; - if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) { - struct ec_response_motion_sensor_data vector = { - .flags = MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO, - .activity_data = { - .activity = MOTIONSENSE_ACTIVITY_BODY_DETECTION, - .state = state, - }, - .sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID, - }; - motion_sense_fifo_stage_data(&vector, NULL, 0, - __hw_clock_source_read()); - motion_sense_fifo_commit_data(); - } /* change the motion state */ motion_state = state; if (state == BODY_DETECTION_ON_BODY) { diff --git a/common/motion_sense.c b/common/motion_sense.c index 546034c7e2..16a37d37a5 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -698,26 +698,6 @@ static void check_and_queue_gestures(uint32_t *event) if (IS_ENABLED(CONFIG_GESTURE_SENSOR_DOUBLE_TAP) && (*event & TASK_EVENT_MOTION_ACTIVITY_INTERRUPT( MOTIONSENSE_ACTIVITY_DOUBLE_TAP))) { - if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) { - struct ec_response_motion_sensor_data vector; - - vector.flags = MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO; - /* - * Send events to the FIFO - * AP is ignoring double tap event, do no wake up and no - * automatic disable. - */ - if (IS_ENABLED( - CONFIG_GESTURE_SENSOR_DOUBLE_TAP_FOR_HOST)) - vector.flags |= MOTIONSENSE_SENSOR_FLAG_WAKEUP; - 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()); - motion_sense_fifo_commit_data(); - } /* Call board specific function to process tap */ sensor_board_proc_double_tap(); } @@ -725,20 +705,7 @@ static void check_and_queue_gestures(uint32_t *event) (*event & TASK_EVENT_MOTION_ACTIVITY_INTERRUPT( MOTIONSENSE_ACTIVITY_SIG_MOTION))) { struct motion_sensor_t *activity_sensor; - if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) { - struct ec_response_motion_sensor_data vector; - - /* Send events to the FIFO */ - vector.flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP | - MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO; - 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()); - motion_sense_fifo_commit_data(); - } + /* Disable further detection */ activity_sensor = &motion_sensors[CONFIG_GESTURE_SIGMO_SENSOR]; activity_sensor->drv->manage_activity( @@ -763,12 +730,6 @@ static void check_and_queue_gestures(uint32_t *event) (*motion_orientation_ptr(sensor) != MOTIONSENSE_ORIENTATION_UNKNOWN)) { motion_orientation_update(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(); if (IS_ENABLED(CONFIG_DEBUG_ORIENTATION)) { static const char *const mode[] = { "Landscape", "Portrait", |