summaryrefslogtreecommitdiffstats
path: root/libsensors
diff options
context:
space:
mode:
authorVishnudev Ramakrishnan <vramakri@sta.samsung.com>2011-10-12 17:11:33 -0700
committerArve Hjønnevåg <arve@android.com>2011-10-21 18:10:12 -0700
commitd04c19594464e1f38a5ac54fd4177d39d5748188 (patch)
treebd7befca1aa223987c34cde3f5f660553a1d3e44 /libsensors
parent64b87e947036ee9a416f12f467a59ceca64e75cb (diff)
downloaddevice_samsung_tuna-d04c19594464e1f38a5ac54fd4177d39d5748188.zip
device_samsung_tuna-d04c19594464e1f38a5ac54fd4177d39d5748188.tar.gz
device_samsung_tuna-d04c19594464e1f38a5ac54fd4177d39d5748188.tar.bz2
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 <vramakri@sta.samsung.com>
Diffstat (limited to 'libsensors')
-rw-r--r--libsensors/LightSensor.cpp8
-rw-r--r--libsensors/LightSensor.h1
2 files changed, 9 insertions, 0 deletions
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;
diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h
index ed639f4..ed3b435 100644
--- a/libsensors/LightSensor.h
+++ b/libsensors/LightSensor.h
@@ -33,6 +33,7 @@ struct input_event;
class LightSensor:public SamsungSensorBase {
float mPreviousLight;
+ virtual int handleEnable(int en);
virtual bool handleEvent(input_event const * event);
float indexToValue(size_t index) const;
public: