From 54ef57e3f3e9efbe86fadac9de8e67333c95e2a5 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Tue, 20 Aug 2013 14:40:15 +0200 Subject: sensors: Use Samsung-Sensors Signed-off-by: Paul Kocialkowski --- libsensors/AkmSensor.cpp | 53 ++++++++++++++++++++++++------------------------ libsensors/sensors.cpp | 2 +- libsensors/sensors.h | 14 ++++++------- n7000.mk | 4 ++++ 4 files changed, 38 insertions(+), 35 deletions(-) diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp index 98a17cb..5f7abd0 100644 --- a/libsensors/AkmSensor.cpp +++ b/libsensors/AkmSensor.cpp @@ -32,10 +32,10 @@ /*****************************************************************************/ -int (*akm_is_sensor_enabled)(uint32_t sensor_type); -int (*akm_enable_sensor)(uint32_t sensor_type); -int (*akm_disable_sensor)(uint32_t sensor_type); -int (*akm_set_delay)(uint32_t sensor_type, uint64_t delay); +int (*is_sensor_enabled)(uint32_t sensor_type); +int (*enable_sensor)(uint32_t sensor_type); +int (*disable_sensor)(uint32_t sensor_type); +int (*set_delay)(uint32_t sensor_type, uint64_t delay); int stub_is_sensor_enabled(uint32_t sensor_type) { return 0; @@ -59,8 +59,8 @@ AkmSensor::AkmSensor() * creates a uinput device. */ if (loadAKMLibrary() == 0) { - data_name = "compass_sensor"; - data_fd = openInput("compass_sensor"); + data_name = "compass"; + data_fd = openInput("compass"); } memset(mPendingEvents, 0, sizeof(mPendingEvents)); @@ -84,7 +84,7 @@ AkmSensor::AkmSensor() struct input_absinfo absinfo; short flags = 0; - if (akm_is_sensor_enabled(SENSOR_TYPE_ACCELEROMETER)) { + if (is_sensor_enabled(SENSOR_TYPE_ACCELEROMETER)) { mEnabled |= 1<type; - if (type == EV_REL) { + if (type == EV_ABS) { processEvent(event->code, event->value); mInputReader.next(); } else if (type == EV_SYN) { @@ -281,11 +283,11 @@ void AkmSensor::processEvent(int code, int value) switch (code) { case EVENT_TYPE_ACCEL_X: mPendingMask |= 1<