From d04c19594464e1f38a5ac54fd4177d39d5748188 Mon Sep 17 00:00:00 2001 From: Vishnudev Ramakrishnan Date: Wed, 12 Oct 2011 17:11:33 -0700 Subject: SensorHAL: clear previous light value on enable Sensor HAL changes to make light sensor value to be reported on enabling light sensor. - Ignore the dummy initial value -1 that is pushed by driver - Set previous light value to -1 on enable Change-Id: Iaa64fb02f4b82339ba96146d170ca447f409a5ad Signed-off-by: Vishnudev Ramakrishnan --- libsensors/LightSensor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libsensors/LightSensor.cpp') diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index 8c111f9..15ae4e2 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -34,7 +34,15 @@ LightSensor::LightSensor() mPreviousLight = -1; } +int LightSensor::handleEnable(int en) { + mPreviousLight = -1; + return 0; +} + bool LightSensor::handleEvent(input_event const *event) { + if (event->value == -1) { + return false; + } mPendingEvent.light = indexToValue(event->value); if (mPendingEvent.light != mPreviousLight) { mPreviousLight = mPendingEvent.light; -- cgit v1.1