diff options
author | Furquan Shaikh <furquan@google.com> | 2015-09-23 08:44:27 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-25 00:19:00 -0700 |
commit | f4ef486fc21a655b75c928ed719d366c6e95a2d4 (patch) | |
tree | d58dab854122cd9b03ed1ae147514ea9a6e144c8 | |
parent | 0dde6ad4432d3381d427702b683bf2055eba3e3e (diff) | |
download | chrome-ec-f4ef486fc21a655b75c928ed719d366c6e95a2d4.tar.gz |
motion_sense: Fix issues in SET_ACTIVITY / LIST_ACTIVITIES
1. ret always evaluated to INVALID_PARAM and so SET_ACTIVITY bailed out
early and returned an error to host command.
2. No need to verify sensor id since SET_ACTIVITY / LIST_ACTIVITIES
identify the correct sensor to operate on.
BUG=chrome-os-partner:45710
BRANCH=None
TEST=Compiles successfully. Disable double-tap works as expected.
Change-Id: I58ae9cd5009fadedb3ea78a4eec0452124747707
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/301990
Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
(cherry picked from commit 2a3a120c8f7cca1e032f4be2a198748f0e8b5fb1)
Reviewed-on: https://chromium-review.googlesource.com/302409
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
-rw-r--r-- | common/motion_sense.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index 54b00c5bd4..f72748091a 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -1028,9 +1028,7 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args) #ifdef CONFIG_GESTURE_HOST_DETECTION case MOTIONSENSE_CMD_LIST_ACTIVITIES: { uint32_t enabled, disabled, mask, i; - if (in->sensor_offset.sensor_num != - MOTION_SENSE_ACTIVITY_SENSOR_ID) - return EC_RES_INVALID_PARAM; + out->list_activities.enabled = 0; out->list_activities.disabled = 0; ret = EC_RES_SUCCESS; @@ -1052,10 +1050,9 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args) } case MOTIONSENSE_CMD_SET_ACTIVITY: { uint32_t enabled, disabled, mask, i; - if (in->sensor_offset.sensor_num != - MOTION_SENSE_ACTIVITY_SENSOR_ID) - return EC_RES_INVALID_PARAM; + mask = CONFIG_GESTURE_DETECTION_MASK; + ret = EC_RES_SUCCESS; while (mask && ret == EC_RES_SUCCESS) { i = get_next_bit(&mask); sensor = &motion_sensors[i]; |