hardware/gps
Révision | 4f94c7e432c71c994ffa4cda149b89e5b58b40d1 (tree) |
---|---|
l'heure | 2015-04-07 16:56:45 |
Auteur | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
enable gps.huawei
@@ -1,4 +1,4 @@ | ||
1 | -# Copyright (C) 2011 The Android-x86 Open Source Project | |
1 | +# Copyright (C) 2011-2014 The Android-x86 Open Source Project | |
2 | 2 | |
3 | 3 | ifeq ($(strip $(BOARD_HAS_GPS_HARDWARE)),true) |
4 | 4 | LOCAL_PATH := $(call my-dir) |
@@ -6,15 +6,18 @@ LOCAL_PATH := $(call my-dir) | ||
6 | 6 | # HAL module implemenation, not prelinked and stored in |
7 | 7 | # hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so |
8 | 8 | include $(CLEAR_VARS) |
9 | -LOCAL_PRELINK_MODULE := false | |
10 | 9 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw |
11 | 10 | LOCAL_SHARED_LIBRARIES := liblog libcutils |
12 | 11 | LOCAL_MODULE := gps.default |
13 | 12 | LOCAL_MODULE_TAGS := optional |
14 | -ifeq ($(strip $(BOARD_GPS_HARDWARE)),huawei) | |
15 | -LOCAL_SRC_FILES := gps_huawei.c | |
16 | -else | |
17 | 13 | LOCAL_SRC_FILES := gps.c |
18 | -endif | |
14 | +include $(BUILD_SHARED_LIBRARY) | |
15 | + | |
16 | +include $(CLEAR_VARS) | |
17 | +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw | |
18 | +LOCAL_SHARED_LIBRARIES := liblog libcutils | |
19 | +LOCAL_MODULE := gps.huawei | |
20 | +LOCAL_MODULE_TAGS := optional | |
21 | +LOCAL_SRC_FILES := gps_huawei.c | |
19 | 22 | include $(BUILD_SHARED_LIBRARY) |
20 | 23 | endif |
@@ -42,7 +42,7 @@ | ||
42 | 42 | #define GPS_DEBUG 0 |
43 | 43 | |
44 | 44 | #if GPS_DEBUG |
45 | -# define D(...) LOGD(__VA_ARGS__) | |
45 | +# define D(...) ALOGD(__VA_ARGS__) | |
46 | 46 | #else |
47 | 47 | # define D(...) ((void)0) |
48 | 48 | #endif |
@@ -170,7 +170,7 @@ static void dev_power(int state) | ||
170 | 170 | return ; //RvdB |
171 | 171 | |
172 | 172 | if (property_get("gps.power_on",prop,GPS_POWER_IF) == 0) { |
173 | - LOGE("no gps power interface name"); | |
173 | + ALOGE("no gps power interface name"); | |
174 | 174 | return; |
175 | 175 | } |
176 | 176 |
@@ -179,7 +179,7 @@ static void dev_power(int state) | ||
179 | 179 | } while (fd < 0 && errno == EINTR); |
180 | 180 | |
181 | 181 | if (fd < 0) { |
182 | - LOGE("could not open gps power interface: %s", prop ); | |
182 | + ALOGE("could not open gps power interface: %s", prop ); | |
183 | 183 | return; |
184 | 184 | } |
185 | 185 |
@@ -926,7 +926,7 @@ static void nmea_reader_parse( NmeaReader* r ) | ||
926 | 926 | } |
927 | 927 | gmtime_r( (time_t*) &r->fix.timestamp, &utc ); |
928 | 928 | p += snprintf(p, end-p, " time=%s", asctime( &utc ) ); |
929 | - LOGE("%s\n",temp); | |
929 | + ALOGE("%s\n",temp); | |
930 | 930 | } |
931 | 931 | #endif |
932 | 932 | } |
@@ -1067,7 +1067,7 @@ static void gps_status_cb( GpsState* state , GpsStatusValue status) | ||
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | |
1070 | -static void gps_set_capabilities_cb( GpsState* state , uint32_t caps) | |
1070 | +static void gps_set_capabilities_cb( GpsState* state, unsigned long caps) | |
1071 | 1071 | { |
1072 | 1072 | D("%s()", __FUNCTION__ ); |
1073 | 1073 | if (state->callbacks.set_capabilities_cb) { |
@@ -1151,13 +1151,13 @@ static void* gps_state_thread( void* arg ) | ||
1151 | 1151 | nevents = epoll_wait( epoll_fd, events, 2, -1 ); |
1152 | 1152 | if (nevents < 0) { |
1153 | 1153 | if (errno != EINTR) |
1154 | - LOGE("epoll_wait() unexpected error: %s", strerror(errno)); | |
1154 | + ALOGE("epoll_wait() unexpected error: %s", strerror(errno)); | |
1155 | 1155 | continue; |
1156 | 1156 | } |
1157 | 1157 | D("gps thread received %d events", nevents); |
1158 | 1158 | for (ne = 0; ne < nevents; ne++) { |
1159 | 1159 | if ((events[ne].events & (EPOLLERR|EPOLLHUP)) != 0) { |
1160 | - LOGE("EPOLLERR or EPOLLHUP after epoll_wait() !?"); | |
1160 | + ALOGE("EPOLLERR or EPOLLHUP after epoll_wait() !?"); | |
1161 | 1161 | goto Exit; |
1162 | 1162 | } |
1163 | 1163 | if ((events[ne].events & EPOLLIN) != 0) { |
@@ -1188,7 +1188,7 @@ static void* gps_state_thread( void* arg ) | ||
1188 | 1188 | state->init = STATE_START; |
1189 | 1189 | |
1190 | 1190 | if ( pthread_create( &state->tmr_thread, NULL, gps_timer_thread, state ) != 0 ) { |
1191 | - LOGE("could not create gps timer thread: %s", strerror(errno)); | |
1191 | + ALOGE("could not create gps timer thread: %s", strerror(errno)); | |
1192 | 1192 | started = 0; |
1193 | 1193 | state->init = STATE_INIT; |
1194 | 1194 | goto Exit; |
@@ -1236,7 +1236,7 @@ static void* gps_state_thread( void* arg ) | ||
1236 | 1236 | } |
1237 | 1237 | else |
1238 | 1238 | { |
1239 | - LOGE("epoll_wait() returned unkown fd %d ?", fd); | |
1239 | + ALOGE("epoll_wait() returned unkown fd %d ?", fd); | |
1240 | 1240 | } |
1241 | 1241 | } |
1242 | 1242 | } |
@@ -1296,7 +1296,7 @@ static int open_serialport( const char* name ) | ||
1296 | 1296 | } while (fd < 0 && errno == EINTR); |
1297 | 1297 | |
1298 | 1298 | if (fd < 0) { |
1299 | - LOGE("could not open serial device %s: %s", name, strerror(errno) ); | |
1299 | + ALOGE("could not open serial device %s: %s", name, strerror(errno) ); | |
1300 | 1300 | return fd; |
1301 | 1301 | } |
1302 | 1302 |
@@ -1394,7 +1394,7 @@ static void gps_state_init( GpsState* state ) | ||
1394 | 1394 | |
1395 | 1395 | state->fd = open_serialport( gps_data ); |
1396 | 1396 | if (state->fd < 0) { |
1397 | - LOGE("could not open gps serial device %s: %s", gps_data, strerror(errno) ); | |
1397 | + ALOGE("could not open gps serial device %s: %s", gps_data, strerror(errno) ); | |
1398 | 1398 | dev_power(0); |
1399 | 1399 | return; |
1400 | 1400 | } |
@@ -1413,7 +1413,7 @@ static void gps_state_init( GpsState* state ) | ||
1413 | 1413 | |
1414 | 1414 | state->ctrl_fd = open_serialport( gps_ctrl ); |
1415 | 1415 | if (state->ctrl_fd < 0) { |
1416 | - LOGE("could not open gps serial device %s: %s", gps_ctrl, strerror(errno) ); | |
1416 | + ALOGE("could not open gps serial device %s: %s", gps_ctrl, strerror(errno) ); | |
1417 | 1417 | close(state->fd); |
1418 | 1418 | state->fd = -1; |
1419 | 1419 | dev_power(0); |
@@ -1448,13 +1448,13 @@ static void gps_state_init( GpsState* state ) | ||
1448 | 1448 | serial_write(state->ctrl_fd,"AT^WPDGP\r\n"); |
1449 | 1449 | |
1450 | 1450 | if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, state->control ) < 0 ) { |
1451 | - LOGE("could not create thread control socket pair: %s", strerror(errno)); | |
1451 | + ALOGE("could not create thread control socket pair: %s", strerror(errno)); | |
1452 | 1452 | goto Fail; |
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | |
1456 | 1456 | if ( pthread_create( &state->thread, NULL, gps_state_thread, state ) != 0 ) { |
1457 | - LOGE("could not create gps thread: %s", strerror(errno)); | |
1457 | + ALOGE("could not create gps thread: %s", strerror(errno)); | |
1458 | 1458 | goto Fail; |
1459 | 1459 | } |
1460 | 1460 |
@@ -1751,7 +1751,7 @@ static const GpsInterface sGpsInterface = { | ||
1751 | 1751 | |
1752 | 1752 | static const GpsInterface* gps_get_hardware_interface(struct gps_device_t* dev) |
1753 | 1753 | { |
1754 | - LOGV("get_interface was called"); | |
1754 | + ALOGV("get_interface was called"); | |
1755 | 1755 | return &sGpsInterface; |
1756 | 1756 | } |
1757 | 1757 |
@@ -1775,7 +1775,7 @@ static struct hw_module_methods_t gps_module_methods = { | ||
1775 | 1775 | .open = open_gps |
1776 | 1776 | }; |
1777 | 1777 | |
1778 | -DLL_PUBLIC const struct hw_module_t HAL_MODULE_INFO_SYM = { | |
1778 | +DLL_PUBLIC struct hw_module_t HAL_MODULE_INFO_SYM = { | |
1779 | 1779 | .tag = HARDWARE_MODULE_TAG, |
1780 | 1780 | .version_major = 1, |
1781 | 1781 | .version_minor = 0, |