aboutsummaryrefslogtreecommitdiffstats
path: root/libsensors/LightSensor.cpp
diff options
context:
space:
mode:
authorsbrissen <sbrissen@hotmail.com>2013-11-13 09:01:02 -0500
committersbrissen <sbrissen@hotmail.com>2013-11-13 09:12:59 -0500
commit7fb9174903c3415abc027c9d4de508946c3011e5 (patch)
tree05de01c6e9845aa212e8832ba75681bfb35f0b1f /libsensors/LightSensor.cpp
parent0dc75f6b11c6cb5cb40bfda497269ae2d4718446 (diff)
downloaddevice_samsung_kona-common-7fb9174903c3415abc027c9d4de508946c3011e5.zip
device_samsung_kona-common-7fb9174903c3415abc027c9d4de508946c3011e5.tar.gz
device_samsung_kona-common-7fb9174903c3415abc027c9d4de508946c3011e5.tar.bz2
kona-common: 4.4 updates
Change-Id: I99fae341e0f1e827608f43a14c9648a9476721ed
Diffstat (limited to 'libsensors/LightSensor.cpp')
-rw-r--r--libsensors/LightSensor.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp
index e931e2e..3159c9e 100644
--- a/libsensors/LightSensor.cpp
+++ b/libsensors/LightSensor.cpp
@@ -121,12 +121,10 @@ int LightSensor::readEvents(sensors_event_t* data, int count)
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
if (type == EV_REL) {
- // Convert adc value to lux assuming:
- // I = 10 * log(Ev) uA
- // R = 47kOhm
- // Max adc value 4095 = 3.3V
- // 1/4 of light reaches sensor
- mPendingEvent.light = event->value;
+ if(event->value < 0)
+ mPendingEvent.light = 0;
+ else
+ mPendingEvent.light = event->value;
} else if (type == EV_SYN) {
mPendingEvent.timestamp = timevalToNano(event->time);
if (mEnabled) {