summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: