summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-11-10 11:33:40 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-11-14 16:29:13 +0000
commit58595665f762eae9c24ddb3e82907b0ea27e453a (patch)
tree373d3321e4a221f123444ca4464ad2bed7d435e4
parent5246e8bffed2cea283f4e0104468b8d73d77789c (diff)
downloadchrome-ec-58595665f762eae9c24ddb3e82907b0ea27e453a.tar.gz
common: host: Do no report sensor when motion_sensor_count set to 0.
On some machine (kefka), the number of sensor is set at run time to 0. Be sure we do not report that sensors or sensor FIFO are available to the kernel. BRANCH=glados TEST=On kefka, check no iio devices are reported, even when sensor FIFO is in the firmware. On Sabin, check all expected IIO devices are present. BUG=b:27849483 Change-Id: I6babefd175bcf6839ceb19b670fe178b609bc248 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410280 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/host_command.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/host_command.c b/common/host_command.c
index 61d8b85b66..a666dd6f6e 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -11,6 +11,7 @@
#include "host_command.h"
#include "link_defs.h"
#include "lpc.h"
+#include "include/motion_sense.h"
#include "shared_mem.h"
#include "system.h"
#include "task.h"
@@ -693,7 +694,8 @@ static int host_command_get_features(struct host_cmd_handler_args *args)
| EC_FEATURE_MASK_0(EC_FEATURE_LED)
#endif
#ifdef HAS_TASK_MOTIONSENSE
- | EC_FEATURE_MASK_0(EC_FEATURE_MOTION_SENSE)
+ | (motion_sensor_count > 0 ?
+ EC_FEATURE_MASK_0(EC_FEATURE_MOTION_SENSE) : 0)
#endif
#ifdef HAS_TASK_KEYSCAN
| EC_FEATURE_MASK_0(EC_FEATURE_KEYB)
@@ -749,7 +751,8 @@ static int host_command_get_features(struct host_cmd_handler_args *args)
| EC_FEATURE_MASK_0(EC_FEATURE_USB_MUX)
#endif
#ifdef CONFIG_ACCEL_FIFO
- | EC_FEATURE_MASK_0(EC_FEATURE_MOTION_SENSE_FIFO)
+ | (motion_sensor_count > 0 ?
+ EC_FEATURE_MASK_0(EC_FEATURE_MOTION_SENSE_FIFO) : 0)
#endif
;
return EC_RES_SUCCESS;