summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Repinski <repinski23@gmail.com>2015-11-10 17:08:22 -0600
committerZiyan <jaraidaniel@gmail.com>2016-01-17 22:41:00 +0100
commitcb8261e6db2a6a13ea67b1848e1cab6b0e7091ec (patch)
treee9102f989c42bef769442b101dda2ba6f35c163e
parent85779371e527f94e865dc0450c703676d858bc30 (diff)
downloaddevice_samsung_tuna-cb8261e6db2a6a13ea67b1848e1cab6b0e7091ec.zip
device_samsung_tuna-cb8261e6db2a6a13ea67b1848e1cab6b0e7091ec.tar.gz
device_samsung_tuna-cb8261e6db2a6a13ea67b1848e1cab6b0e7091ec.tar.bz2
libsensors/invensense: Clean-up.
-rw-r--r--invensense/libinvensense_hal/MPLSensor.cpp27
-rw-r--r--invensense/libinvensense_hal/MPLSensor.h6
-rw-r--r--invensense/libinvensense_hal/SensorBase.cpp7
-rw-r--r--invensense/libinvensense_hal/SensorBase.h6
-rw-r--r--libsensors/SamsungSensorBase.cpp7
-rw-r--r--libsensors/SamsungSensorBase.h5
6 files changed, 14 insertions, 44 deletions
diff --git a/invensense/libinvensense_hal/MPLSensor.cpp b/invensense/libinvensense_hal/MPLSensor.cpp
index 835d46b..ca08ad5 100644
--- a/invensense/libinvensense_hal/MPLSensor.cpp
+++ b/invensense/libinvensense_hal/MPLSensor.cpp
@@ -146,10 +146,10 @@ MPLSensor::MPLSensor() :
mNewData(0),
mDmpStarted(false),
mMasterSensorMask(INV_ALL_SENSORS),
- mLocalSensorMask(ALL_MPL_SENSORS_NP), mPollTime(-1),
+ mLocalSensorMask(ALL_MPL_SENSORS_NP),
mCurFifoRate(-1), mHaveGoodMpuCal(false), mHaveGoodCompassCal(false),
mUseTimerIrqAccel(false), mUsetimerIrqCompass(true),
- mUseTimerirq(false), mSampleCount(0),
+ mUseTimerirq(false),
mEnabled(0), mPendingMask(0)
{
FUNC_LOG;
@@ -413,7 +413,6 @@ void MPLSensor::setPowerStates(int enabled_sensors)
clearIrqData(irq_set);
mDmpStarted = false;
- mPollTime = -1;
mCurFifoRate = -1;
}
}
@@ -559,7 +558,6 @@ void MPLSensor::cbOnMotion(uint16_t val)
void MPLSensor::cbProcData()
{
mNewData = 1;
- mSampleCount++;
}
//these handlers transform mpl data into one of the Android sensor types
@@ -914,16 +912,6 @@ int MPLSensor::update_delay()
return rv;
}
-/* return the current time in nanoseconds */
-int64_t MPLSensor::now_ns(void)
-{
- //FUNC_LOG;
- struct timespec ts;
-
- clock_gettime(CLOCK_BOOTTIME, &ts);
- return (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
-}
-
int MPLSensor::readEvents(sensors_event_t* data, int count)
{
//VFUNC_LOG;
@@ -1000,17 +988,6 @@ int MPLSensor::getPowerFd() const
return (uintptr_t) inv_get_serial_handle();
}
-int MPLSensor::getPollTime()
-{
- return mPollTime;
-}
-
-bool MPLSensor::hasPendingEvents() const
-{
- //if we are using the polling workaround, force the main loop to check for data every time
- return (mPollTime != -1);
-}
-
void MPLSensor::handlePowerEvent()
{
VFUNC_LOG;
diff --git a/invensense/libinvensense_hal/MPLSensor.h b/invensense/libinvensense_hal/MPLSensor.h
index b6b133e..ea72c72 100644
--- a/invensense/libinvensense_hal/MPLSensor.h
+++ b/invensense/libinvensense_hal/MPLSensor.h
@@ -61,8 +61,6 @@ public:
virtual int getAccelFd() const;
virtual int getTimerFd() const;
virtual int getPowerFd() const;
- virtual int getPollTime();
- virtual bool hasPendingEvents() const;
virtual void handlePowerEvent();
virtual void sleepEvent();
virtual void wakeEvent();
@@ -91,7 +89,6 @@ protected:
int mDmpStarted;
long mMasterSensorMask;
long mLocalSensorMask;
- int mPollTime;
int mCurFifoRate; //current fifo rate
bool mHaveGoodMpuCal; //flag indicating that the cal file can be written
bool mHaveGoodCompassCal;
@@ -99,10 +96,7 @@ protected:
bool mUsetimerIrqCompass;
bool mUseTimerirq;
struct pollfd mPollFds[4];
- int mSampleCount;
pthread_mutex_t mMplMutex;
- int64_t now_ns();
- int64_t select_ns(unsigned long long time_set[]);
enum FILEHANDLES
{
diff --git a/invensense/libinvensense_hal/SensorBase.cpp b/invensense/libinvensense_hal/SensorBase.cpp
index d13d7e4..4661a55 100644
--- a/invensense/libinvensense_hal/SensorBase.cpp
+++ b/invensense/libinvensense_hal/SensorBase.cpp
@@ -82,13 +82,6 @@ bool SensorBase::hasPendingEvents() const {
return false;
}
-int64_t SensorBase::getTimestamp() {
- struct timespec t;
- t.tv_sec = t.tv_nsec = 0;
- clock_gettime(CLOCK_BOOTTIME, &t);
- return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
-}
-
int SensorBase::openInput(const char* inputName) {
int fd = -1;
const char *dirname = "/dev/input";
diff --git a/invensense/libinvensense_hal/SensorBase.h b/invensense/libinvensense_hal/SensorBase.h
index bb4d055..eb50550 100644
--- a/invensense/libinvensense_hal/SensorBase.h
+++ b/invensense/libinvensense_hal/SensorBase.h
@@ -36,12 +36,6 @@ protected:
int data_fd;
int openInput(const char* inputName);
- static int64_t getTimestamp();
-
-
- static int64_t timevalToNano(timeval const& t) {
- return t.tv_sec*1000000000LL + t.tv_usec*1000;
- }
int open_device();
int close_device();
diff --git a/libsensors/SamsungSensorBase.cpp b/libsensors/SamsungSensorBase.cpp
index 49ba7e8..0492d94 100644
--- a/libsensors/SamsungSensorBase.cpp
+++ b/libsensors/SamsungSensorBase.cpp
@@ -139,6 +139,13 @@ done:
return result;
}
+int64_t SamsungSensorBase::getTimestamp() {
+ struct timespec t;
+ t.tv_sec = t.tv_nsec = 0;
+ clock_gettime(CLOCK_BOOTTIME, &t);
+ return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
+}
+
int SamsungSensorBase::readEvents(sensors_event_t* data, int count)
{
if (count < 1)
diff --git a/libsensors/SamsungSensorBase.h b/libsensors/SamsungSensorBase.h
index c989c71..1440e37 100644
--- a/libsensors/SamsungSensorBase.h
+++ b/libsensors/SamsungSensorBase.h
@@ -40,6 +40,11 @@ protected:
int mSensorCode;
pthread_mutex_t mLock;
+ static int64_t getTimestamp();
+ static int64_t timevalToNano(timeval const& t) {
+ return t.tv_sec*1000000000LL + t.tv_usec*1000;
+ }
+
char *makeSysfsName(const char *input_name,
const char *input_file);