summaryrefslogtreecommitdiffstats
path: root/libsensors
diff options
context:
space:
mode:
authortim.sk.lee <tim.sk.lee@samsung.com>2010-10-28 00:33:01 -0700
committerMaarten Hooft <mthooft@google.com>2010-11-09 21:06:33 -0800
commit286d99b62709872dc9f891991cccc1272e884cb7 (patch)
treececb132f223bd3a223240aef20e42fd810d12fdf /libsensors
parent1f5810e62f6bd75d850c98c3263dbcc4c7885198 (diff)
downloaddevice_samsung_crespo-286d99b62709872dc9f891991cccc1272e884cb7.zip
device_samsung_crespo-286d99b62709872dc9f891991cccc1272e884cb7.tar.gz
device_samsung_crespo-286d99b62709872dc9f891991cccc1272e884cb7.tar.bz2
S5PC11X: SENSOR: Mag, accel, orientation and gyro get the cotinuous events
By using EV_REL instead of EV_ABS, sensors can get continous events even though they're not changed. Change-Id: I2341c0d1a1cdec223328796355ebf0210a9dea5e Signed-off-by: tim.sk.lee <tim.sk.lee@samsung.com>
Diffstat (limited to 'libsensors')
-rw-r--r--libsensors/AkmSensor.cpp4
-rw-r--r--libsensors/GyroSensor.cpp2
-rw-r--r--libsensors/sensors.cpp8
-rw-r--r--libsensors/sensors.h29
4 files changed, 20 insertions, 23 deletions
diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp
index f2470c3..68d2fc2 100644
--- a/libsensors/AkmSensor.cpp
+++ b/libsensors/AkmSensor.cpp
@@ -245,7 +245,7 @@ int AkmSensor::readEvents(sensors_event_t* data, int count)
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
- if (type == EV_ABS) {
+ if (type == EV_REL) {
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) {
@@ -320,4 +320,4 @@ void AkmSensor::processEvent(int code, int value)
uint8_t(value & SENSOR_STATE_MASK);
break;
}
-} \ No newline at end of file
+}
diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp
index c478e40..7f6b864 100644
--- a/libsensors/GyroSensor.cpp
+++ b/libsensors/GyroSensor.cpp
@@ -143,7 +143,7 @@ again:
#endif
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
- if (type == EV_ABS) {
+ if (type == EV_REL) {
float value = event->value;
if (event->code == EVENT_TYPE_GYRO_X) {
mPendingEvent.data[0] = value * CONVERT_GYRO_X;
diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp
index a7e79e6..2f85225 100644
--- a/libsensors/sensors.cpp
+++ b/libsensors/sensors.cpp
@@ -70,15 +70,15 @@ static const struct sensor_t sSensorList[] = {
{ "KR3DM 3-axis Accelerometer",
"STMicroelectronics",
1, SENSORS_ACCELERATION_HANDLE,
- SENSOR_TYPE_ACCELEROMETER, RANGE_A, RESOLUTION_A, 0.23f, 0, { } },
+ SENSOR_TYPE_ACCELEROMETER, RANGE_A, RESOLUTION_A, 0.23f, 20000, { } },
{ "AK8973 3-axis Magnetic field sensor",
"Asahi Kasei Microdevices",
1, SENSORS_MAGNETIC_FIELD_HANDLE,
- SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 0, { } },
+ SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 30000, { } },
{ "AK8973 Orientation sensor",
"Asahi Kasei Microdevices",
1, SENSORS_ORIENTATION_HANDLE,
- SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 0, { } },
+ SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 30000, { } },
{ "GP2A Light sensor",
"Sharp",
1, SENSORS_LIGHT_HANDLE,
@@ -90,7 +90,7 @@ static const struct sensor_t sSensorList[] = {
{ "K3G Gyroscope sensor",
"STMicroelectronics",
1, SENSORS_GYROSCOPE_HANDLE,
- SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 0, { } },
+ SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 1200, { } },
};
diff --git a/libsensors/sensors.h b/libsensors/sensors.h
index 384d423..20884b6 100644
--- a/libsensors/sensors.h
+++ b/libsensors/sensors.h
@@ -54,29 +54,26 @@ __BEGIN_DECLS
#define AKM_DEVICE_NAME "/dev/akm8973_aot"
-#define EVENT_TYPE_ACCEL_X ABS_Y
-#define EVENT_TYPE_ACCEL_Y ABS_X
-#define EVENT_TYPE_ACCEL_Z ABS_Z
-#define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL
+#define EVENT_TYPE_ACCEL_X REL_Y
+#define EVENT_TYPE_ACCEL_Y REL_X
+#define EVENT_TYPE_ACCEL_Z REL_Z
-#define EVENT_TYPE_YAW ABS_RX
-#define EVENT_TYPE_PITCH ABS_RY
-#define EVENT_TYPE_ROLL ABS_RZ
-#define EVENT_TYPE_ORIENT_STATUS ABS_RUDDER
+#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
/* For AK8973iB */
-#define EVENT_TYPE_MAGV_X ABS_HAT0Y
-#define EVENT_TYPE_MAGV_Y ABS_HAT0X
-#define EVENT_TYPE_MAGV_Z ABS_BRAKE
-#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE
-#define EVENT_TYPE_STEP_COUNT ABS_GAS
+#define EVENT_TYPE_MAGV_X REL_DIAL
+#define EVENT_TYPE_MAGV_Y REL_HWHEEL
+#define EVENT_TYPE_MAGV_Z REL_MISC
#define EVENT_TYPE_PROXIMITY ABS_DISTANCE
#define EVENT_TYPE_LIGHT ABS_MISC
-#define EVENT_TYPE_GYRO_X ABS_RY
-#define EVENT_TYPE_GYRO_Y ABS_RX
-#define EVENT_TYPE_GYRO_Z ABS_RZ
+#define EVENT_TYPE_GYRO_X REL_RY
+#define EVENT_TYPE_GYRO_Y REL_RX
+#define EVENT_TYPE_GYRO_Z REL_RZ
// 720 LSG = 1G