hardware/gps
リビジョン | 4a2ae14c86bc2d9314e99c0577f706442becdfaa (tree) |
---|---|
日時 | 2019-02-22 18:03:06 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
コミッター | Chih-Wei Huang |
Fix building warnings
Remove unused functions.
@@ -11,6 +11,7 @@ LOCAL_MODULE := gps.default | ||
11 | 11 | LOCAL_MODULE_TAGS := optional |
12 | 12 | LOCAL_MODULE_RELATIVE_PATH := hw |
13 | 13 | LOCAL_SRC_FILES := gps.c |
14 | +LOCAL_CFLAGS := -Wno-unused-parameter -Wno-unused-variable | |
14 | 15 | include $(BUILD_SHARED_LIBRARY) |
15 | 16 | |
16 | 17 | include $(CLEAR_VARS) |
@@ -19,5 +20,6 @@ LOCAL_MODULE := gps.huawei | ||
19 | 20 | LOCAL_MODULE_TAGS := optional |
20 | 21 | LOCAL_MODULE_RELATIVE_PATH := hw |
21 | 22 | LOCAL_SRC_FILES := gps_huawei.c |
23 | +LOCAL_CFLAGS := -Wno-unused-parameter -Wno-unused-variable | |
22 | 24 | include $(BUILD_SHARED_LIBRARY) |
23 | 25 | endif |
@@ -59,11 +59,6 @@ static int id_in_fixed[12]; | ||
59 | 59 | #define GPS_DEV_SLOW_UPDATE_RATE (10) |
60 | 60 | #define GPS_DEV_HIGH_UPDATE_RATE (1) |
61 | 61 | |
62 | -static void gps_dev_init(int fd); | |
63 | -static void gps_dev_deinit(int fd); | |
64 | -static void gps_dev_start(int fd); | |
65 | -static void gps_dev_stop(int fd); | |
66 | - | |
67 | 62 | /*****************************************************************/ |
68 | 63 | /*****************************************************************/ |
69 | 64 | /***** *****/ |
@@ -281,18 +276,6 @@ nmea_reader_init( NmeaReader* r ) | ||
281 | 276 | } |
282 | 277 | |
283 | 278 | |
284 | -static void | |
285 | -nmea_reader_set_callback( NmeaReader* r, gps_location_callback cb ) | |
286 | -{ | |
287 | - r->callback = cb; | |
288 | - if (cb != NULL && r->fix.flags != 0) { | |
289 | - D("%s: sending latest fix to new callback", __FUNCTION__); | |
290 | - r->callback( &r->fix ); | |
291 | - r->fix.flags = 0; | |
292 | - } | |
293 | -} | |
294 | - | |
295 | - | |
296 | 279 | static int |
297 | 280 | nmea_reader_update_time( NmeaReader* r, Token tok ) |
298 | 281 | { |
@@ -822,17 +805,6 @@ epoll_register( int epoll_fd, int fd ) | ||
822 | 805 | } |
823 | 806 | |
824 | 807 | |
825 | -static int | |
826 | -epoll_deregister( int epoll_fd, int fd ) | |
827 | -{ | |
828 | - int ret; | |
829 | - do { | |
830 | - ret = epoll_ctl( epoll_fd, EPOLL_CTL_DEL, fd, NULL ); | |
831 | - } while (ret < 0 && errno == EINTR); | |
832 | - return ret; | |
833 | -} | |
834 | - | |
835 | - | |
836 | 808 | /* this is the main thread, it waits for commands from gps_state_start/stop and, |
837 | 809 | * when started, messages from the QEMU GPS daemon. these are simple NMEA sentences |
838 | 810 | * that must be parsed to be converted into GPS fixes sent to the framework |
@@ -875,7 +847,7 @@ gps_state_thread( void* arg ) | ||
875 | 847 | int fd = events[ne].data.fd; |
876 | 848 | |
877 | 849 | if (fd == control_fd) { |
878 | - char cmd = 255; | |
850 | + char cmd = -1; | |
879 | 851 | int ret; |
880 | 852 | D("GPS control fd event"); |
881 | 853 | do { |
@@ -1153,134 +1125,6 @@ const GpsInterface* gps_get_hardware_interface() | ||
1153 | 1125 | /*****************************************************************/ |
1154 | 1126 | /*****************************************************************/ |
1155 | 1127 | |
1156 | -static void gps_dev_power(int state) | |
1157 | -{ | |
1158 | - return; | |
1159 | -} | |
1160 | - | |
1161 | - | |
1162 | -static void gps_dev_send(int fd, char *msg) | |
1163 | -{ | |
1164 | - int i, n, ret; | |
1165 | - | |
1166 | - i = strlen(msg); | |
1167 | - | |
1168 | - n = 0; | |
1169 | - | |
1170 | - do { | |
1171 | - | |
1172 | - ret = write(fd, msg + n, i - n); | |
1173 | - | |
1174 | - if (ret < 0 && errno == EINTR) { | |
1175 | - continue; | |
1176 | - } | |
1177 | - | |
1178 | - n += ret; | |
1179 | - | |
1180 | - } while (n < i); | |
1181 | -} | |
1182 | - | |
1183 | - | |
1184 | -static unsigned char gps_dev_calc_nmea_csum(char *msg) | |
1185 | -{ | |
1186 | - unsigned char csum = 0; | |
1187 | - int i; | |
1188 | - | |
1189 | - for (i = 1; msg[i] != '*'; ++i) { | |
1190 | - csum ^= msg[i]; | |
1191 | - } | |
1192 | - | |
1193 | - return csum; | |
1194 | -} | |
1195 | - | |
1196 | - | |
1197 | -static void gps_dev_set_nmea_message_rate(int fd, char *msg, int rate) | |
1198 | -{ | |
1199 | - char buff[50]; | |
1200 | - int i; | |
1201 | - | |
1202 | - sprintf(buff, "$PUBX,40,%s,%d,%d,%d,0*", msg, rate, rate, rate); | |
1203 | - | |
1204 | - i = strlen(buff); | |
1205 | - | |
1206 | - sprintf((buff + i), "%02x\r\n", gps_dev_calc_nmea_csum(buff)); | |
1207 | - | |
1208 | - gps_dev_send(fd, buff); | |
1209 | - | |
1210 | - D("GPS sent to device: %s", buff); | |
1211 | -} | |
1212 | - | |
1213 | - | |
1214 | -static void gps_dev_set_baud_rate(int fd, int baud) | |
1215 | -{ | |
1216 | - char buff[50]; | |
1217 | - int i, u; | |
1218 | - | |
1219 | - for (u = 0; u < 3; ++u) { | |
1220 | - | |
1221 | - sprintf(buff, "$PUBX,41,%d,0003,0003,%d,0*", u, baud); | |
1222 | - | |
1223 | - i = strlen(buff); | |
1224 | - | |
1225 | - sprintf((buff + i), "%02x\r\n", gps_dev_calc_nmea_csum(buff)); | |
1226 | - | |
1227 | - gps_dev_send(fd, buff); | |
1228 | - | |
1229 | - D("Sent to device: %s", buff); | |
1230 | - | |
1231 | - } | |
1232 | -} | |
1233 | - | |
1234 | - | |
1235 | -static void gps_dev_set_message_rate(int fd, int rate) | |
1236 | -{ | |
1237 | - | |
1238 | - unsigned int i; | |
1239 | - | |
1240 | - char *msg[] = { | |
1241 | - "GGA", "GLL", "VTG", | |
1242 | - "GSA", "GSV", "RMC" | |
1243 | - }; | |
1244 | - | |
1245 | - for (i = 0; i < sizeof(msg)/sizeof(msg[0]); ++i) { | |
1246 | - gps_dev_set_nmea_message_rate(fd, msg[i], rate); | |
1247 | - } | |
1248 | - | |
1249 | - return; | |
1250 | -} | |
1251 | - | |
1252 | - | |
1253 | -static void gps_dev_init(int fd) | |
1254 | -{ | |
1255 | - gps_dev_power(1); | |
1256 | - | |
1257 | - return; | |
1258 | -} | |
1259 | - | |
1260 | - | |
1261 | -static void gps_dev_deinit(int fd) | |
1262 | -{ | |
1263 | - gps_dev_power(0); | |
1264 | -} | |
1265 | - | |
1266 | - | |
1267 | -static void gps_dev_start(int fd) | |
1268 | -{ | |
1269 | - // Set full message rate | |
1270 | - gps_dev_set_message_rate(fd, GPS_DEV_HIGH_UPDATE_RATE); | |
1271 | - | |
1272 | - D("GPS dev start initiated"); | |
1273 | -} | |
1274 | - | |
1275 | - | |
1276 | -static void gps_dev_stop(int fd) | |
1277 | -{ | |
1278 | - // Set slow message rate | |
1279 | - gps_dev_set_message_rate(fd, GPS_DEV_SLOW_UPDATE_RATE); | |
1280 | - | |
1281 | - D("GPS dev stop initiated"); | |
1282 | -} | |
1283 | - | |
1284 | 1128 | |
1285 | 1129 | static int open_gps(const struct hw_module_t* module, char const* name, struct hw_device_t** device) |
1286 | 1130 | { |
@@ -2,7 +2,7 @@ | ||
2 | 2 | ** |
3 | 3 | ** Copyright 2006, The Android Open Source Project |
4 | 4 | ** Copyright 2009, Michael Trimarchi <michael@panicking.kicks-ass.org> |
5 | -** Copyright 2011, Eduardo José Tagle <ejtagle@tutopia.com> | |
5 | +** Copyright 2011, Eduardo José Tagle <ejtagle@tutopia.com> | |
6 | 6 | ** |
7 | 7 | ** This program is free software; you can redistribute it and/or modify it under |
8 | 8 | ** the terms of the GNU General Public License as published by the Free |
@@ -138,18 +138,6 @@ static void serial_write(int fd, char *msg) | ||
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | -static unsigned char calc_nmea_csum(char *msg) | |
142 | -{ | |
143 | - unsigned char csum = 0; | |
144 | - int i; | |
145 | - | |
146 | - for (i = 1; msg[i] != '*'; ++i) { | |
147 | - csum ^= msg[i]; | |
148 | - } | |
149 | - | |
150 | - return csum; | |
151 | -} | |
152 | - | |
153 | 141 | |
154 | 142 | /*****************************************************************/ |
155 | 143 | /*****************************************************************/ |
@@ -202,43 +190,6 @@ static void dev_power(int state) | ||
202 | 190 | |
203 | 191 | } |
204 | 192 | |
205 | -static void dev_set_nmea_message_rate(int fd,const char *msg, int rate) | |
206 | -{ | |
207 | - | |
208 | - char buff[50]; | |
209 | - int i; | |
210 | - | |
211 | - sprintf(buff, "$PUBX,40,%s,%d,%d,%d,0*", msg, rate, rate, rate); | |
212 | - | |
213 | - i = strlen(buff); | |
214 | - | |
215 | - sprintf((buff + i), "%02x\r\n", calc_nmea_csum(buff)); | |
216 | - | |
217 | - serial_write(fd, buff); | |
218 | - | |
219 | - D("gps sent to device: %s", buff); | |
220 | - | |
221 | - return; | |
222 | - | |
223 | -} | |
224 | - | |
225 | -static void dev_set_message_rate(int fd, int rate) | |
226 | -{ | |
227 | - | |
228 | - unsigned int i; | |
229 | - static const char *msg[] = { | |
230 | - "GGA", "GLL", "ZDA", | |
231 | - "VTG", "GSA", "GSV", | |
232 | - "RMC" | |
233 | - }; | |
234 | - | |
235 | - for (i = 0; i < sizeof(msg)/sizeof(msg[0]); ++i) { | |
236 | - dev_set_nmea_message_rate(fd, msg[i], rate); | |
237 | - } | |
238 | - | |
239 | - return; | |
240 | -} | |
241 | - | |
242 | 193 | |
243 | 194 | static void dev_start(int fd) |
244 | 195 | { |
@@ -1014,15 +965,6 @@ static int epoll_register( int epoll_fd, int fd ) | ||
1014 | 965 | } |
1015 | 966 | |
1016 | 967 | |
1017 | -static int epoll_deregister( int epoll_fd, int fd ) | |
1018 | -{ | |
1019 | - int ret; | |
1020 | - do { | |
1021 | - ret = epoll_ctl( epoll_fd, EPOLL_CTL_DEL, fd, NULL ); | |
1022 | - } while (ret < 0 && errno == EINTR); | |
1023 | - return ret; | |
1024 | -} | |
1025 | - | |
1026 | 968 | static void gps_nmea_thread_cb( GpsState* state ) |
1027 | 969 | { |
1028 | 970 | D("%s()", __FUNCTION__ ); |
@@ -1163,7 +1105,7 @@ static void* gps_state_thread( void* arg ) | ||
1163 | 1105 | |
1164 | 1106 | if (fd == control_fd) |
1165 | 1107 | { |
1166 | - char cmd = 255; | |
1108 | + char cmd = -1; | |
1167 | 1109 | int ret; |
1168 | 1110 | D("gps control fd event"); |
1169 | 1111 | do { |
@@ -1677,7 +1619,8 @@ static const AGpsInterface sAGpsInterface = { | ||
1677 | 1619 | agps_conn_open, |
1678 | 1620 | agps_conn_closed, |
1679 | 1621 | agps_conn_failed, |
1680 | - agps_set_server | |
1622 | + agps_set_server, | |
1623 | + 0 | |
1681 | 1624 | }; |
1682 | 1625 | |
1683 | 1626 |
@@ -1779,6 +1722,6 @@ DLL_PUBLIC struct hw_module_t HAL_MODULE_INFO_SYM = { | ||
1779 | 1722 | .version_minor = 0, |
1780 | 1723 | .id = GPS_HARDWARE_MODULE_ID, |
1781 | 1724 | .name = "GPS Module", |
1782 | - .author = "Eduardo José Tagle", | |
1725 | + .author = "Eduardo José Tagle", | |
1783 | 1726 | .methods = &gps_module_methods, |
1784 | 1727 | }; |