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
commitc1191a6c4c13d7b8bae00645b2b99f0347051cf7 (patch)
tree1e1960aab02f40f960c3ce855d7a81e4b134092d /libsensors
parentd36c96c9a8d0b725f65ad05244e78c506a4b154f (diff)
downloaddevice_samsung_tuna-c1191a6c4c13d7b8bae00645b2b99f0347051cf7.zip
device_samsung_tuna-c1191a6c4c13d7b8bae00645b2b99f0347051cf7.tar.gz
device_samsung_tuna-c1191a6c4c13d7b8bae00645b2b99f0347051cf7.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: