From e7f6f749c496b1196ba739aca5a311dc10815497 Mon Sep 17 00:00:00 2001 From: "Andreas.Eversberg" Date: Sun, 24 Oct 2010 12:20:08 +0000 Subject: [PATCH] [layer23] Fix of GPS states --- src/host/layer23/include/osmocom/bb/mobile/gps.h | 1 + src/host/layer23/src/mobile/app_mobile.c | 1 + src/host/layer23/src/mobile/gps.c | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/host/layer23/include/osmocom/bb/mobile/gps.h b/src/host/layer23/include/osmocom/bb/mobile/gps.h index b3b4335..e45cbc5 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/gps.h +++ b/src/host/layer23/include/osmocom/bb/mobile/gps.h @@ -35,5 +35,6 @@ extern struct gps gps; int gps_open(void); void gps_close(void); +void gps_init(void); diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 650b450..6ba4b9e 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -173,6 +173,7 @@ int l23_app_init(struct osmocom_ms *ms) srand(time(NULL)); + gps_init(); gsm_support_init(ms); gsm_sim_init(ms); gsm_settings_init(ms); diff --git a/src/host/layer23/src/mobile/gps.c b/src/host/layer23/src/mobile/gps.c index c66da6d..1a4e9e4 100644 --- a/src/host/layer23/src/mobile/gps.c +++ b/src/host/layer23/src/mobile/gps.c @@ -65,6 +65,7 @@ static int gps_line(char *line) if (line[36] != 'A') { LOGP(DGPS, LOGL_INFO, "%s (invalid)\n", line); gps.valid = 0; + return 0; } gps.valid = 1; @@ -112,7 +113,7 @@ static int gps_line(char *line) longitude = 360.0 - longitude; gps.longitude = longitude; - LOGP(DGPS, LOGL_INFO, "%s\n", line); + LOGP(DGPS, LOGL_DEBUG, "%s\n", line); LOGP(DGPS, LOGL_INFO, " time=%02d:%02d:%02d %04d-%02d-%02d, " "diff-to-host=%d, latitude=%do%.4f, longitude=%do%.4f\n", tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_year + 1900, @@ -242,4 +243,9 @@ void gps_close(void) gps_bfd.fd = -1; /* -1 or 0 indicates: 'close' */ } +void gps_init(void) +{ + memset(&gps_bfd, 0, sizeof(gps_bfd)); +} + -- 2.20.1