diff options
-rw-r--r-- | 6515/libsensors_iio/MPLSensor.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/6515/libsensors_iio/MPLSensor.cpp b/6515/libsensors_iio/MPLSensor.cpp index b6d762a..c63d8b4 100644 --- a/6515/libsensors_iio/MPLSensor.cpp +++ b/6515/libsensors_iio/MPLSensor.cpp @@ -5838,6 +5838,12 @@ int MPLSensor::flush(int handle) LOGV_IF(PROCESS_VERBOSE, "HAL: flush - select sensor %s (handle %d)", sname.string(), handle); + if (((what != StepDetector) && (!(mEnabled & (1 << what)))) || + ((what == StepDetector) && !(mFeatureActiveMask & INV_DMP_PEDOMETER))) { + LOGE_IF(ENG_VERBOSE, "HAL: flush - sensor %s not enabled", sname.string()); + return -EINVAL; + } + if(!(mBatchEnabled & (1 << what))) { LOGV_IF(PROCESS_VERBOSE, "HAL:flush - batch mode not enabled for sensor %s (handle %d)", sname.string(), handle); } |