summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsbrissen <sbrissen@hotmail.com>2014-01-17 15:15:26 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2014-01-17 15:15:26 +0000
commit2a60473968bc1aba488a7411611f03af310261e7 (patch)
tree0c7ae45111a4375d1861d6f71137bbde37881374
parente7b4798694c17476485d1f0b427ec09c06fe7dee (diff)
parent23cda827610c50a9f3ec8cd63610191c69fe6291 (diff)
downloaddevice_samsung_t0lte-2a60473968bc1aba488a7411611f03af310261e7.tar.gz
device_samsung_t0lte-2a60473968bc1aba488a7411611f03af310261e7.tar.bz2
device_samsung_t0lte-2a60473968bc1aba488a7411611f03af310261e7.zip
Merge "t0lte: sensors clean up" into cm-11.0
-rw-r--r--libsensors/AkmSensor.cpp35
-rw-r--r--libsensors/sensors.cpp5
-rw-r--r--libsensors/sensors.h11
3 files changed, 10 insertions, 41 deletions
diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp
index 160df2a..baca688 100644
--- a/libsensors/AkmSensor.cpp
+++ b/libsensors/AkmSensor.cpp
@@ -83,11 +83,6 @@ AkmSensor::AkmSensor()
mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD;
mPendingEvents[MagneticField].magnetic.status = SENSOR_STATUS_ACCURACY_HIGH;
- mPendingEvents[Orientation ].version = sizeof(sensors_event_t);
- mPendingEvents[Orientation ].sensor = ID_O;
- mPendingEvents[Orientation ].type = SENSOR_TYPE_ORIENTATION;
- mPendingEvents[Orientation ].orientation.status = SENSOR_STATUS_ACCURACY_HIGH;
-
// read the actual value of all sensors if they're enabled already
struct input_absinfo absinfo;
short flags = 0;
@@ -103,25 +98,6 @@ AkmSensor::AkmSensor()
mPendingEvents[MagneticField].magnetic.z = absinfo.value * CONVERT_M_Z;
}
}
-
- if (akm_is_sensor_enabled(SENSOR_TYPE_ORIENTATION)) {
- mEnabled |= 1<<Orientation;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_YAW), &absinfo)) {
- mPendingEvents[Orientation].orientation.azimuth = absinfo.value;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PITCH), &absinfo)) {
- mPendingEvents[Orientation].orientation.pitch = absinfo.value;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ROLL), &absinfo)) {
- mPendingEvents[Orientation].orientation.roll = -absinfo.value;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ORIENT_STATUS), &absinfo)) {
- mPendingEvents[Orientation].orientation.status = uint8_t(absinfo.value & SENSOR_STATE_MASK);
- }
- }
-
- // disable temperature sensor, since it is not supported
- akm_disable_sensor(SENSOR_TYPE_TEMPERATURE);
}
AkmSensor::~AkmSensor()
@@ -131,7 +107,6 @@ AkmSensor::~AkmSensor()
}
}
-
int AkmSensor::setInitialState()
{
return 0;
@@ -158,7 +133,6 @@ int AkmSensor::enable(int32_t handle, int en)
switch (what) {
case MagneticField: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break;
- case Orientation: sensor_type = SENSOR_TYPE_ORIENTATION; break;
}
short flags = newState;
if (en){
@@ -190,7 +164,6 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns)
switch (handle) {
case ID_M: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break;
- case ID_O: sensor_type = SENSOR_TYPE_ORIENTATION; break;
}
if (sensor_type == 0)
@@ -204,6 +177,14 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns)
close(fd);
}
+ fd = open("/sys/class/sensors/ssp_sensor/ori_poll_delay", O_RDWR);
+ if (fd >= 0) {
+ char buf[80];
+ sprintf(buf, "%lld", ns);
+ write(fd, buf, strlen(buf)+1);
+ close(fd);
+ }
+
mDelays[what] = ns;
return 0;
}
diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp
index 193c932..689c717 100644
--- a/libsensors/sensors.cpp
+++ b/libsensors/sensors.cpp
@@ -52,8 +52,6 @@
#define SENSORS_LIGHT (1<<ID_L)
#define SENSORS_PROXIMITY (1<<ID_P)
#define SENSORS_GYROSCOPE (1<<ID_GY)
-#define SENSORS_LINEAR_ACCEL (1<<ID_LA)
-#define SENSORS_GRAVITY (1<<ID_GR)
#define SENSORY_PRESSURE (1<<ID_PR)
#define SENSORS_ACCELERATION_HANDLE 0
@@ -63,8 +61,6 @@
#define SENSORS_PROXIMITY_HANDLE 4
#define SENSORS_GYROSCOPE_HANDLE 5
#define SENSORS_PRESSURE_HANDLE 6
-#define SENSORS_LINEAR_ACCEL_HANDLE 7
-#define SENSORS_GRAVITY_HANDLE 8
#define AKM_FTRACE 0
#define AKM_DEBUG 0
@@ -173,7 +169,6 @@ private:
return accel;
case ID_M:
case ID_O:
- case ID_GR:
return akm;
case ID_P:
return proximity;
diff --git a/libsensors/sensors.h b/libsensors/sensors.h
index a4fe794..4b36ffe 100644
--- a/libsensors/sensors.h
+++ b/libsensors/sensors.h
@@ -40,8 +40,6 @@ __BEGIN_DECLS
#define ID_P (4)
#define ID_GY (5)
#define ID_PR (6)
-#define ID_LA (7)
-#define ID_GR (8)
#define SSP_ACCEL (1)
#define SSP_GYRO (2)
@@ -67,11 +65,6 @@ __BEGIN_DECLS
#define EVENT_TYPE_ACCEL_X REL_X //1
#define EVENT_TYPE_ACCEL_Y REL_Y //0
#define EVENT_TYPE_ACCEL_Z REL_Z //2
-//#define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL //8
-
-#define EVENT_TYPE_GRAVITY_X ABS_X //1
-#define EVENT_TYPE_GRAVITY_Y ABS_Y //0
-#define EVENT_TYPE_GRAVITY_Z ABS_Z //2
#define EVENT_TYPE_YAW ABS_RX //3
#define EVENT_TYPE_PITCH ABS_RY //4
@@ -85,7 +78,7 @@ __BEGIN_DECLS
#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE
#define EVENT_TYPE_STEP_COUNT ABS_GAS
#define EVENT_TYPE_PROXIMITY ABS_DISTANCE
-#define EVENT_TYPE_LIGHT REL_HWHEEL
+#define EVENT_TYPE_LIGHT REL_MISC
#define EVENT_TYPE_GYRO_X REL_RX
#define EVENT_TYPE_GYRO_Y REL_RY
@@ -105,7 +98,7 @@ __BEGIN_DECLS
// conversion of magnetic data to uT units
#define CONVERT_M (1.0f/16.0f)
-#define CONVERT_M_X (-CONVERT_M)
+#define CONVERT_M_X (CONVERT_M)
#define CONVERT_M_Y (CONVERT_M)
#define CONVERT_M_Z (CONVERT_M)