summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-03-24 11:36:45 (GMT)
committerPaul Kocialkowski <contact@paulk.fr>2013-03-24 11:36:45 (GMT)
commit184125415a55b45458ef303eae593d3c7dfc16c8 (patch)
treecd76a54ddbec419d47a51b32ed939c2beeb6e72b
parent2f0942e4df16247863dd5717b7e61535bcd11cf1 (diff)
downloaddevice_samsung_crespo-replicant-4.0.zip
device_samsung_crespo-replicant-4.0.tar.gz
device_samsung_crespo-replicant-4.0.tar.bz2
sensors: Samsung Sensors compatibilityreplicant-4.0
Change-Id: I000c975da1f38c77269057b870463a7b3422da17 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--libsensors/AkmSensor.cpp12
-rw-r--r--libsensors/sensors.h24
2 files changed, 12 insertions, 24 deletions
diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp
index 5a269e4..de60481 100644
--- a/libsensors/AkmSensor.cpp
+++ b/libsensors/AkmSensor.cpp
@@ -118,9 +118,6 @@ AkmSensor::AkmSensor()
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
@@ -226,7 +223,7 @@ int AkmSensor::readEvents(sensors_event_t* data, int count)
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
- if (type == EV_REL) {
+ if (type == EV_ABS) {
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) {
@@ -295,12 +292,5 @@ void AkmSensor::processEvent(int code, int value)
mPendingMask |= 1<<Orientation;
mPendingEvents[Orientation].orientation.roll = value * CONVERT_O_R;
break;
- case EVENT_TYPE_ORIENT_STATUS:
- uint8_t status = uint8_t(value & SENSOR_STATE_MASK);
- if (status == 4)
- status = 0;
- mPendingMask |= 1<<Orientation;
- mPendingEvents[Orientation].orientation.status = status;
- break;
}
}
diff --git a/libsensors/sensors.h b/libsensors/sensors.h
index 4b12606..6b52ec9 100644
--- a/libsensors/sensors.h
+++ b/libsensors/sensors.h
@@ -54,19 +54,18 @@ __BEGIN_DECLS
#define AKM_DEVICE_NAME "/dev/akm8973_aot"
-#define EVENT_TYPE_ACCEL_X REL_Y
-#define EVENT_TYPE_ACCEL_Y REL_X
-#define EVENT_TYPE_ACCEL_Z REL_Z
+#define EVENT_TYPE_ACCEL_X ABS_X
+#define EVENT_TYPE_ACCEL_Y ABS_Y
+#define EVENT_TYPE_ACCEL_Z ABS_Z
-#define EVENT_TYPE_YAW REL_RX
-#define EVENT_TYPE_PITCH REL_RY
-#define EVENT_TYPE_ROLL REL_RZ
-#define EVENT_TYPE_ORIENT_STATUS REL_WHEEL
+#define EVENT_TYPE_YAW ABS_RX
+#define EVENT_TYPE_PITCH ABS_RY
+#define EVENT_TYPE_ROLL ABS_RZ
+//#define EVENT_TYPE_ORIENT_STATUS REL_WHEEL
-/* For AK8973iB */
-#define EVENT_TYPE_MAGV_X REL_DIAL
-#define EVENT_TYPE_MAGV_Y REL_HWHEEL
-#define EVENT_TYPE_MAGV_Z REL_MISC
+#define EVENT_TYPE_MAGV_X ABS_THROTTLE
+#define EVENT_TYPE_MAGV_Y ABS_RUDDER
+#define EVENT_TYPE_MAGV_Z ABS_WHEEL
#define EVENT_TYPE_PROXIMITY ABS_DISTANCE
#define EVENT_TYPE_LIGHT ABS_MISC
@@ -80,9 +79,8 @@ __BEGIN_DECLS
#define LSB (64.0f)
#define NUMOFACCDATA (8.0f)
-// conversion of acceleration data to SI units (m/s^2)
#define RANGE_A (2*GRAVITY_EARTH)
-#define CONVERT_A (GRAVITY_EARTH / LSB / NUMOFACCDATA)
+#define CONVERT_A (1.0f/1000.0f) * (GRAVITY_EARTH / LSB / NUMOFACCDATA)
#define CONVERT_A_X (CONVERT_A)
#define CONVERT_A_Y (CONVERT_A)
#define CONVERT_A_Z (CONVERT_A)