diff options
author | tim.sk.lee <tim.sk.lee@samsung.com> | 2011-03-14 19:09:23 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-14 19:09:23 -0700 |
commit | cc1175893e65b97a3dd357ee42bde2553a3ea213 (patch) | |
tree | 3a51d87d97c842f90449e749ca7f5b8897ec1a2e /libsensors | |
parent | c4db96dfad07c067a17bcdd489eab746c387e715 (diff) | |
parent | 8f19ee06f8d60f59dfb787c5f46f6869b64e9bed (diff) | |
download | device_samsung_crespo-cc1175893e65b97a3dd357ee42bde2553a3ea213.tar.gz device_samsung_crespo-cc1175893e65b97a3dd357ee42bde2553a3ea213.tar.bz2 device_samsung_crespo-cc1175893e65b97a3dd357ee42bde2553a3ea213.zip |
am 8f19ee06: am c6d33b6e: am 63a93125: SENSOR: Ignore the first 350ms gyroscope sensor events
* commit '8f19ee06f8d60f59dfb787c5f46f6869b64e9bed':
SENSOR: Ignore the first 350ms gyroscope sensor events
Diffstat (limited to 'libsensors')
-rw-r--r-- | libsensors/GyroSensor.cpp | 12 | ||||
-rw-r--r-- | libsensors/GyroSensor.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp index 7f6b864..ecebb61 100644 --- a/libsensors/GyroSensor.cpp +++ b/libsensors/GyroSensor.cpp @@ -26,14 +26,15 @@ #include "GyroSensor.h" #define FETCH_FULL_EVENT_BEFORE_RETURN 1 - +#define IGNORE_EVENT_TIME 350000000 /*****************************************************************************/ GyroSensor::GyroSensor() : SensorBase(NULL, "gyro"), mEnabled(0), mInputReader(4), - mHasPendingEvent(false) + mHasPendingEvent(false), + mEnabledTime(0) { mPendingEvent.version = sizeof(sensors_event_t); mPendingEvent.sensor = ID_GY; @@ -86,6 +87,7 @@ int GyroSensor::enable(int32_t, int en) { buf[1] = 0; if (flags) { buf[0] = '1'; + mEnabledTime = getTimestamp() + IGNORE_EVENT_TIME; } else { buf[0] = '0'; } @@ -155,9 +157,11 @@ again: } else if (type == EV_SYN) { mPendingEvent.timestamp = timevalToNano(event->time); if (mEnabled) { - *data++ = mPendingEvent; + if (mPendingEvent.timestamp >= mEnabledTime) { + *data++ = mPendingEvent; + numEventReceived++; + } count--; - numEventReceived++; } } else { LOGE("GyroSensor: unknown event (type=%d, code=%d)", diff --git a/libsensors/GyroSensor.h b/libsensors/GyroSensor.h index e5a9241..e8997de 100644 --- a/libsensors/GyroSensor.h +++ b/libsensors/GyroSensor.h @@ -37,6 +37,7 @@ class GyroSensor : public SensorBase { bool mHasPendingEvent; char input_sysfs_path[PATH_MAX]; int input_sysfs_path_len; + int64_t mEnabledTime; int setInitialState(); |