summaryrefslogtreecommitdiffstats
path: root/libsensors
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2011-11-10 20:51:37 -0800
committerArve Hjønnevåg <arve@android.com>2011-11-10 20:52:11 -0800
commit03e49a2f665cd5449cdfee5f23a37e8b82a889ab (patch)
tree6d4a0ddbb3844b24f56f78f10deef3952828c3ad /libsensors
parent85e80ef669952286e5a8ea5ea642bc7acf4cd549 (diff)
downloaddevice_samsung_crespo-03e49a2f665cd5449cdfee5f23a37e8b82a889ab.tar.gz
device_samsung_crespo-03e49a2f665cd5449cdfee5f23a37e8b82a889ab.tar.bz2
device_samsung_crespo-03e49a2f665cd5449cdfee5f23a37e8b82a889ab.zip
sensors: Remove workaround for lightsensor driver bug
Change-Id: I5d8bd3f355ca46f6c60713b1516a621e45b53cfc
Diffstat (limited to 'libsensors')
-rw-r--r--libsensors/LightSensor.cpp13
-rw-r--r--libsensors/LightSensor.h1
2 files changed, 1 insertions, 13 deletions
diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp
index a12c218..5df7cd5 100644
--- a/libsensors/LightSensor.cpp
+++ b/libsensors/LightSensor.cpp
@@ -27,17 +27,9 @@
/*****************************************************************************/
-/* The Crespo ADC sends 4 somewhat bogus events after enabling the sensor.
- This becomes a problem if the phone is turned off in bright light
- and turned back on in the dark.
- To avoid this we ignore the first 4 events received after enabling the sensor.
- */
-#define FIRST_GOOD_EVENT 5
-
LightSensor::LightSensor()
: SensorBase(NULL, "lightsensor-level"),
mEnabled(0),
- mEventsSinceEnable(0),
mInputReader(4),
mHasPendingEvent(false)
{
@@ -79,7 +71,6 @@ int LightSensor::setDelay(int32_t handle, int64_t ns)
int LightSensor::enable(int32_t handle, int en)
{
int flags = en ? 1 : 0;
- mEventsSinceEnable = 0;
if (flags != mEnabled) {
int fd;
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
@@ -136,12 +127,10 @@ int LightSensor::readEvents(sensors_event_t* data, int count)
// Max adc value 4095 = 3.3V
// 1/4 of light reaches sensor
mPendingEvent.light = powf(10, event->value * (330.0f / 4095.0f / 47.0f)) * 4;
- if (mEventsSinceEnable < FIRST_GOOD_EVENT)
- mEventsSinceEnable++;
}
} else if (type == EV_SYN) {
mPendingEvent.timestamp = timevalToNano(event->time);
- if (mEnabled && mEventsSinceEnable >= FIRST_GOOD_EVENT) {
+ if (mEnabled) {
*data++ = mPendingEvent;
count--;
numEventReceived++;
diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h
index 2d5ed50..79e0ccf 100644
--- a/libsensors/LightSensor.h
+++ b/libsensors/LightSensor.h
@@ -32,7 +32,6 @@ struct input_event;
class LightSensor : public SensorBase {
int mEnabled;
- int mEventsSinceEnable;
InputEventCircularReader mInputReader;
sensors_event_t mPendingEvent;
bool mHasPendingEvent;