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 MAX_SENSOR_CNT (ID_T+1)
34 #define SENSORS_ACCELERATION (1<<ID_A)
35 #define SENSORS_MAGNETIC_FIELD (1<<ID_M)
36 #define SENSORS_ORIENTATION (1<<ID_O)
37 #define SENSORS_LIGHT (1<<ID_L)
38 #define SENSORS_PROXIMITY (1<<ID_P)
39 #define SENSORS_GYROSCOPE (1<<ID_GY)
40 #define SENSORS_PRESSURE (1<<ID_PR)
41 #define SENSORS_TEMPERATURE (1<<ID_T)
43 #define SENSORS_ACCELERATION_HANDLE 0
44 #define SENSORS_MAGNETIC_FIELD_HANDLE 1
45 #define SENSORS_ORIENTATION_HANDLE 2
46 #define SENSORS_LIGHT_HANDLE 3
47 #define SENSORS_PROXIMITY_HANDLE 4
48 #define SENSORS_GYROSCOPE_HANDLE 5
49 #define SENSORS_PRESSURE_HANDLE 6
50 #define SENSORS_TEMPERATURE_HANDLE 7
52 /* The next one is used to set the timeout used for polling the file
55 #define POLL_TIMEOUT_MSEC 3000L