• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

hardware/gps


コミットメタ情報

リビジョン4a2ae14c86bc2d9314e99c0577f706442becdfaa (tree)
日時2019-02-22 18:03:06
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

Fix building warnings

Remove unused functions.

変更サマリ

差分

--- a/Android.mk
+++ b/Android.mk
@@ -11,6 +11,7 @@ LOCAL_MODULE := gps.default
1111 LOCAL_MODULE_TAGS := optional
1212 LOCAL_MODULE_RELATIVE_PATH := hw
1313 LOCAL_SRC_FILES := gps.c
14+LOCAL_CFLAGS := -Wno-unused-parameter -Wno-unused-variable
1415 include $(BUILD_SHARED_LIBRARY)
1516
1617 include $(CLEAR_VARS)
@@ -19,5 +20,6 @@ LOCAL_MODULE := gps.huawei
1920 LOCAL_MODULE_TAGS := optional
2021 LOCAL_MODULE_RELATIVE_PATH := hw
2122 LOCAL_SRC_FILES := gps_huawei.c
23+LOCAL_CFLAGS := -Wno-unused-parameter -Wno-unused-variable
2224 include $(BUILD_SHARED_LIBRARY)
2325 endif
--- a/gps.c
+++ b/gps.c
@@ -59,11 +59,6 @@ static int id_in_fixed[12];
5959 #define GPS_DEV_SLOW_UPDATE_RATE (10)
6060 #define GPS_DEV_HIGH_UPDATE_RATE (1)
6161
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-
6762 /*****************************************************************/
6863 /*****************************************************************/
6964 /***** *****/
@@ -281,18 +276,6 @@ nmea_reader_init( NmeaReader* r )
281276 }
282277
283278
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-
296279 static int
297280 nmea_reader_update_time( NmeaReader* r, Token tok )
298281 {
@@ -822,17 +805,6 @@ epoll_register( int epoll_fd, int fd )
822805 }
823806
824807
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-
836808 /* this is the main thread, it waits for commands from gps_state_start/stop and,
837809 * when started, messages from the QEMU GPS daemon. these are simple NMEA sentences
838810 * that must be parsed to be converted into GPS fixes sent to the framework
@@ -875,7 +847,7 @@ gps_state_thread( void* arg )
875847 int fd = events[ne].data.fd;
876848
877849 if (fd == control_fd) {
878- char cmd = 255;
850+ char cmd = -1;
879851 int ret;
880852 D("GPS control fd event");
881853 do {
@@ -1153,134 +1125,6 @@ const GpsInterface* gps_get_hardware_interface()
11531125 /*****************************************************************/
11541126 /*****************************************************************/
11551127
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-
12841128
12851129 static int open_gps(const struct hw_module_t* module, char const* name, struct hw_device_t** device)
12861130 {
--- a/gps_huawei.c
+++ b/gps_huawei.c
@@ -2,7 +2,7 @@
22 **
33 ** Copyright 2006, The Android Open Source Project
44 ** 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>
66 **
77 ** This program is free software; you can redistribute it and/or modify it under
88 ** 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)
138138 return;
139139 }
140140
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-
153141
154142 /*****************************************************************/
155143 /*****************************************************************/
@@ -202,43 +190,6 @@ static void dev_power(int state)
202190
203191 }
204192
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-
242193
243194 static void dev_start(int fd)
244195 {
@@ -1014,15 +965,6 @@ static int epoll_register( int epoll_fd, int fd )
1014965 }
1015966
1016967
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-
1026968 static void gps_nmea_thread_cb( GpsState* state )
1027969 {
1028970 D("%s()", __FUNCTION__ );
@@ -1163,7 +1105,7 @@ static void* gps_state_thread( void* arg )
11631105
11641106 if (fd == control_fd)
11651107 {
1166- char cmd = 255;
1108+ char cmd = -1;
11671109 int ret;
11681110 D("gps control fd event");
11691111 do {
@@ -1677,7 +1619,8 @@ static const AGpsInterface sAGpsInterface = {
16771619 agps_conn_open,
16781620 agps_conn_closed,
16791621 agps_conn_failed,
1680- agps_set_server
1622+ agps_set_server,
1623+ 0
16811624 };
16821625
16831626
@@ -1779,6 +1722,6 @@ DLL_PUBLIC struct hw_module_t HAL_MODULE_INFO_SYM = {
17791722 .version_minor = 0,
17801723 .id = GPS_HARDWARE_MODULE_ID,
17811724 .name = "GPS Module",
1782- .author = "Eduardo José Tagle",
1725+ .author = "Eduardo José Tagle",
17831726 .methods = &gps_module_methods,
17841727 };