From 28e3038bf810016925668ff5d8236325d37aaab9 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Wed, 11 Dec 2013 18:23:22 +0530 Subject: N7100: Open source sensors smdk4412: https://gerrit.omnirom.org/#/c/3934/ This reverts commit 1862e93acf995525493f0c47f4ba6fde37611ba2. Change-Id: Ib5c14f7da94ea1696bae36f7d0bf19a0c63e57e9 Conflicts: BoardConfig.mk --- libsensors/SensorBase.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 libsensors/SensorBase.h (limited to 'libsensors/SensorBase.h') diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h new file mode 100644 index 0000000..d9e4b47 --- /dev/null +++ b/libsensors/SensorBase.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_SENSOR_BASE_H +#define ANDROID_SENSOR_BASE_H + +#include +#include +#include +#include + +#include "sensors.h" + + +/*****************************************************************************/ + +struct sensors_event_t; + +class SensorBase { +protected: + const char* dev_name; + const char* data_name; + char input_name[PATH_MAX]; + int dev_fd; + 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(); + +public: + SensorBase( + const char* dev_name, + const char* data_name); + + virtual ~SensorBase(); + + virtual int readEvents(sensors_event_t* data, int count) = 0; + virtual bool hasPendingEvents() const; + virtual int getFd() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled) = 0; + int sspEnable(const char* sensorname, int sensorvalue, int en); + virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); + virtual int flush(int handle); + +}; + +/*****************************************************************************/ + +#endif // ANDROID_SENSOR_BASE_H -- cgit v1.1 From cd5145640187472147f77a2e9be8e7055097b581 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Tue, 25 Feb 2014 14:34:07 -0500 Subject: n7100: fix up sensors -dibable all sensors when screen is off. port from t0: http://review.cyanogenmod.org/#/c/60292/ Change-Id: I66566f5a17acdc7c6dda84eef81af928567cfa37 Conflicts: libsensors/sensors.h --- libsensors/SensorBase.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libsensors/SensorBase.h') diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h index d9e4b47..aeac510 100644 --- a/libsensors/SensorBase.h +++ b/libsensors/SensorBase.h @@ -61,6 +61,7 @@ public: virtual int setDelay(int32_t handle, int64_t ns); virtual int enable(int32_t handle, int enabled) = 0; int sspEnable(const char* sensorname, int sensorvalue, int en); + int sspWrite(int sensorvalue); virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); virtual int flush(int handle); -- cgit v1.1 From 25167a3ebc96d346ec41c8361a8396afac77ad5d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Jun 2014 21:22:28 +0530 Subject: Revert "n7100: fix up sensors" This reverts commit cd5145640187472147f77a2e9be8e7055097b581. --- libsensors/SensorBase.h | 1 - 1 file changed, 1 deletion(-) (limited to 'libsensors/SensorBase.h') diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h index aeac510..d9e4b47 100644 --- a/libsensors/SensorBase.h +++ b/libsensors/SensorBase.h @@ -61,7 +61,6 @@ public: virtual int setDelay(int32_t handle, int64_t ns); virtual int enable(int32_t handle, int enabled) = 0; int sspEnable(const char* sensorname, int sensorvalue, int en); - int sspWrite(int sensorvalue); virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); virtual int flush(int handle); -- cgit v1.1 From e4884eadc0332211a061f4643d4a978e2991a636 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Jun 2014 21:22:50 +0530 Subject: Revert "N7100: Open source sensors" This reverts commit 28e3038bf810016925668ff5d8236325d37aaab9. --- libsensors/SensorBase.h | 71 ------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 libsensors/SensorBase.h (limited to 'libsensors/SensorBase.h') diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h deleted file mode 100644 index d9e4b47..0000000 --- a/libsensors/SensorBase.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_SENSOR_BASE_H -#define ANDROID_SENSOR_BASE_H - -#include -#include -#include -#include - -#include "sensors.h" - - -/*****************************************************************************/ - -struct sensors_event_t; - -class SensorBase { -protected: - const char* dev_name; - const char* data_name; - char input_name[PATH_MAX]; - int dev_fd; - 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(); - -public: - SensorBase( - const char* dev_name, - const char* data_name); - - virtual ~SensorBase(); - - virtual int readEvents(sensors_event_t* data, int count) = 0; - virtual bool hasPendingEvents() const; - virtual int getFd() const; - virtual int setDelay(int32_t handle, int64_t ns); - virtual int enable(int32_t handle, int enabled) = 0; - int sspEnable(const char* sensorname, int sensorvalue, int en); - virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); - virtual int flush(int handle); - -}; - -/*****************************************************************************/ - -#endif // ANDROID_SENSOR_BASE_H -- cgit v1.1 From 9fec655291ddf36e5e568ce57a8ae10a161e3a5a Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Thu, 1 Jan 2015 21:33:39 +0530 Subject: n7100: Bring back open source sensors This reverts commit 00ac0f43785afd63a16b74034f4701928e941360. Change-Id: I810bad7b533d8c8edf0152b36874789e02994bad n7100: sensors: Fix buffer size Change-Id: I93a999a47ade6982c0b1fec56d611465f8dad830 Conflicts: n7100.mk --- libsensors/SensorBase.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 libsensors/SensorBase.h (limited to 'libsensors/SensorBase.h') diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h new file mode 100644 index 0000000..aeac510 --- /dev/null +++ b/libsensors/SensorBase.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_SENSOR_BASE_H +#define ANDROID_SENSOR_BASE_H + +#include +#include +#include +#include + +#include "sensors.h" + + +/*****************************************************************************/ + +struct sensors_event_t; + +class SensorBase { +protected: + const char* dev_name; + const char* data_name; + char input_name[PATH_MAX]; + int dev_fd; + 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(); + +public: + SensorBase( + const char* dev_name, + const char* data_name); + + virtual ~SensorBase(); + + virtual int readEvents(sensors_event_t* data, int count) = 0; + virtual bool hasPendingEvents() const; + virtual int getFd() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled) = 0; + int sspEnable(const char* sensorname, int sensorvalue, int en); + int sspWrite(int sensorvalue); + virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); + virtual int flush(int handle); + +}; + +/*****************************************************************************/ + +#endif // ANDROID_SENSOR_BASE_H -- cgit v1.1