From 8537e27d601a73708e26b912d8cd3190af28aae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Espen=20Fjellv=C3=A6r=20Olsen?= Date: Thu, 19 Apr 2012 10:05:35 +0200 Subject: [PATCH] Update AkmSensor to manually set poll interval Change-Id: I84fc5c3fc1cb552874129512ea6dfc19b1f9a60a --- exynos4/hal/libsensors/AkmSensor.cpp | 23 ++++++++++++++++++++++- exynos4/hal/libsensors/AkmSensor.h | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/exynos4/hal/libsensors/AkmSensor.cpp b/exynos4/hal/libsensors/AkmSensor.cpp index c147bd68..98a17cb4 100644 --- a/exynos4/hal/libsensors/AkmSensor.cpp +++ b/exynos4/hal/libsensors/AkmSensor.cpp @@ -175,6 +175,7 @@ int AkmSensor::enable(int32_t handle, int en) int AkmSensor::setDelay(int32_t handle, int64_t ns) { + int what = -1; uint32_t sensor_type = 0; if (ns < 0) @@ -189,9 +190,29 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns) if (sensor_type == 0) return -EINVAL; - return akm_set_delay(sensor_type, ns); + mDelays[what] = ns; + return update_delay(); +} + +int AkmSensor::update_delay() +{ + if (mEnabled) { + uint64_t wanted = -1LLU; + for (int i=0 ; i