summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAravind Akella <aakella@google.com>2013-12-05 16:24:59 -0800
committerNick Vaccaro <nvaccaro@google.com>2014-01-31 22:33:51 +0000
commitebff73c37d5f1581702430f4a0348c160b99b57e (patch)
tree978ae3c39ef5dd058aeaced2adac6b03d200fbbb /services
parentade9a911d04dbd4bfbd3e80a917ea67a581b4797 (diff)
downloadframeworks_native-ebff73c37d5f1581702430f4a0348c160b99b57e.zip
frameworks_native-ebff73c37d5f1581702430f4a0348c160b99b57e.tar.gz
frameworks_native-ebff73c37d5f1581702430f4a0348c160b99b57e.tar.bz2
Bug fix for SensorFusion data rate.
SensorFusion is always returning data at the slowest possible sampling rate (5 Hz). batch() is getting called twice, first time with the requested rate and second time with the slowest rate (which overwrites the requested rate). Fix batch call in SensorFusion::activate() Bug: 12064319 Change-Id: If62f3e514233f69810336fd22b136b4395b667d3
Diffstat (limited to 'services')
-rw-r--r--services/sensorservice/SensorFusion.cpp16
-rw-r--r--services/sensorservice/SensorFusion.h1
2 files changed, 4 insertions, 13 deletions
diff --git a/services/sensorservice/SensorFusion.cpp b/services/sensorservice/SensorFusion.cpp
index 03f94be..8512d6b 100644
--- a/services/sensorservice/SensorFusion.cpp
+++ b/services/sensorservice/SensorFusion.cpp
@@ -102,15 +102,6 @@ status_t SensorFusion::activate(void* ident, bool enabled) {
}
}
- if (enabled) {
- ALOGD_IF(DEBUG_CONNECTIONS, "SensorFusion calling batch ident=%p ", ident);
- // Activating a sensor in continuous mode is equivalent to calling batch with the default
- // period and timeout equal to ZERO, followed by a call to activate.
- mSensorDevice.batch(ident, mAcc.getHandle(), 0, DEFAULT_EVENTS_PERIOD, 0);
- mSensorDevice.batch(ident, mMag.getHandle(), 0, DEFAULT_EVENTS_PERIOD, 0);
- mSensorDevice.batch(ident, mGyro.getHandle(), 0, DEFAULT_EVENTS_PERIOD, 0);
- }
-
mSensorDevice.activate(ident, mAcc.getHandle(), enabled);
mSensorDevice.activate(ident, mMag.getHandle(), enabled);
mSensorDevice.activate(ident, mGyro.getHandle(), enabled);
@@ -127,9 +118,10 @@ status_t SensorFusion::activate(void* ident, bool enabled) {
}
status_t SensorFusion::setDelay(void* ident, int64_t ns) {
- mSensorDevice.setDelay(ident, mAcc.getHandle(), ns);
- mSensorDevice.setDelay(ident, mMag.getHandle(), ms2ns(20));
- mSensorDevice.setDelay(ident, mGyro.getHandle(), mTargetDelayNs);
+ // Call batch with timeout zero instead of setDelay().
+ mSensorDevice.batch(ident, mAcc.getHandle(), 0, ns, 0);
+ mSensorDevice.batch(ident, mMag.getHandle(), 0, ms2ns(20), 0);
+ mSensorDevice.batch(ident, mGyro.getHandle(), 0, mTargetDelayNs, 0);
return NO_ERROR;
}
diff --git a/services/sensorservice/SensorFusion.h b/services/sensorservice/SensorFusion.h
index b8f360f..432adbc 100644
--- a/services/sensorservice/SensorFusion.h
+++ b/services/sensorservice/SensorFusion.h
@@ -37,7 +37,6 @@ class SensorDevice;
class SensorFusion : public Singleton<SensorFusion> {
friend class Singleton<SensorFusion>;
- static const nsecs_t DEFAULT_EVENTS_PERIOD = 200000000; // 5 Hz
SensorDevice& mSensorDevice;
Sensor mAcc;