2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ANDROID_SENSORS_COMMON_H
18 #define ANDROID_SENSORS_COMMON_H
20 #include <linux/input.h>
22 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
32 #define ID_R (8) // rotation vector
33 #define ID_SC (9) // "faked" level compass
34 #define MAX_SENSOR_CNT (ID_SC+1)
36 #define SENSORS_ACCELERATION (1<<ID_A)
37 #define SENSORS_MAGNETIC_FIELD (1<<ID_M)
38 #define SENSORS_ORIENTATION (1<<ID_O)
39 #define SENSORS_LIGHT (1<<ID_L)
40 #define SENSORS_PROXIMITY (1<<ID_P)
41 #define SENSORS_GYROSCOPE (1<<ID_GY)
42 #define SENSORS_PRESSURE (1<<ID_PR)
43 #define SENSORS_TEMPERATURE (1<<ID_T)
44 #define SENSORS_ROT_VEC (1<<ID_R)
45 #define SENSORS_SYNCOMPASS (1<<ID_SC)
47 #define SENSORS_ACCELERATION_HANDLE 0
48 #define SENSORS_MAGNETIC_FIELD_HANDLE 1
49 #define SENSORS_ORIENTATION_HANDLE 2
50 #define SENSORS_LIGHT_HANDLE 3
51 #define SENSORS_PROXIMITY_HANDLE 4
52 #define SENSORS_GYROSCOPE_HANDLE 5
53 #define SENSORS_PRESSURE_HANDLE 6
54 #define SENSORS_TEMPERATURE_HANDLE 7
55 #define SENSORS_ROT_VEC_HANDLE 8
56 #define SENSORS_SYNCOMPASS_HANDLE 9
58 /* The next one is used to set the timeout used for polling the file
61 #define POLL_TIMEOUT_MSEC 3000L