Commit | Line | Data |
---|---|---|
d42e7319 JB |
1 | /* |
2 | * Copyright (c) 2012 Simon Busch <morphis@gravedo.de> | |
3 | * | |
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 | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
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. | |
15 | * | |
16 | */ | |
17 | ||
18 | #include <assert.h> | |
19 | #include <stdio.h> | |
20 | #include <stdlib.h> | |
21 | #include <android/hardware/sensors.h> | |
22 | ||
23 | int main(int argc, char **argv) | |
24 | { | |
25 | struct hw_module_t *hwmod; | |
26 | struct sensors_poll_device_t *dev; | |
27 | ||
28 | hw_get_module(SENSORS_HARDWARE_MODULE_ID, (const hw_module_t**) &hwmod); | |
29 | assert(hwmod != NULL); | |
30 | ||
31 | if (sensors_open(hwmod, &dev) < 0) { | |
32 | printf("ERROR: failed to open sensors device\n"); | |
33 | exit(1); | |
34 | } | |
35 | ||
36 | if (sensors_close(dev) < 0) { | |
37 | printf("ERROR: failed to close sensors device\n"); | |
38 | exit(1); | |
39 | } | |
40 | ||
41 | return 0; | |
42 | } | |
43 | ||
44 | // vim:ts=4:sw=4:noexpandtab |