summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCMakeLists.txt3
-rw-r--r--configure.in4
-rw-r--r--navit/main.c2
-rw-r--r--navit/vehicle/gpsd/CMakeLists.txt7
-rw-r--r--navit/vehicle/gpsd/vehicle_gpsd.c54
5 files changed, 1 insertions, 69 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c8e3f72e..32b6e5aea 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,10 +131,9 @@ endif (NOT DISABLE_QT)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(QUESOGLC quesoglc)
- pkg_check_modules(LIBGPS libgps)
pkg_check_modules(LIBLOCATION liblocation)
pkg_check_modules(LIBOSSO libosso)
- pkg_check_modules(LIBGPS19 libgps>=2.90)
+ pkg_check_modules(LIBGPS libgps>=3.1) # libgpsd<V3.1 is buggy if LC_ALL is set.
pkg_check_modules(LIBGARMIN libgarmin)
pkg_check_modules(IMLIB2 imlib2)
if(IMLIB2_FOUND)
diff --git a/configure.in b/configure.in
index 9943e7deb..4d01bf993 100644
--- a/configure.in
+++ b/configure.in
@@ -1062,10 +1062,6 @@ then
PKG_CHECK_MODULES([GPSD], [libgps], have_libgps="yes", have_libgps="no")
if test "x$have_libgps" = "xyes"; then
AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have libgps.)
- PKG_CHECK_MODULES([LIBGPS19], [libgps >= 2.90], have_libgps19="yes", have_libgps19="no")
- if test "x$have_libgps19" = "xyes"; then
- AC_DEFINE([HAVE_LIBGPS19],[],Define to 1 if you have libgps19.)
- fi
else
AC_CHECK_HEADER(gps.h, AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have the <gps.h> header file.) GPSD_LIBS="-lgps", vehicle_gpsd=no; vehicle_gpsd_reason="no gps.h and no gpsd pkgconfig" )
fi
diff --git a/navit/main.c b/navit/main.c
index 231b70f80..c8c27dcad 100644
--- a/navit/main.c
+++ b/navit/main.c
@@ -404,8 +404,6 @@ main_init(const char *program)
main_setup_environment(2);
#endif /* _WIN32 || _WIN32_WCE */
- if (getenv("LC_ALL"))
- dbg(0,"Warning: LC_ALL is set, this might lead to problems (e.g. strange positions from GPS)\n");
s = getenv("NAVIT_WID");
if (s) {
setenv("SDL_WINDOWID", s, 0);
diff --git a/navit/vehicle/gpsd/CMakeLists.txt b/navit/vehicle/gpsd/CMakeLists.txt
index 091df2f71..1c204f6b4 100644
--- a/navit/vehicle/gpsd/CMakeLists.txt
+++ b/navit/vehicle/gpsd/CMakeLists.txt
@@ -1,8 +1 @@
module_add_library(vehicle_gpsd vehicle_gpsd.c)
-if (LIBGPS19_FOUND)
- set_property(
- TARGET vehicle_gpsd
- APPEND PROPERTY COMPILE_DEFINITIONS HAVE_LIBGPS19=1
- )
-endif (LIBGPS19_FOUND)
-
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c
index f9ab8adfc..766a454d3 100644
--- a/navit/vehicle/gpsd/vehicle_gpsd.c
+++ b/navit/vehicle/gpsd/vehicle_gpsd.c
@@ -70,12 +70,7 @@ static struct vehicle_priv {
static void vehicle_gpsd_io(struct vehicle_priv *priv);
static void
-#ifdef HAVE_LIBGPS19
vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len)
-#else
-vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
- int level)
-#endif
{
char *pos,*nmea_data_buf;
int i=0,sats_signal=0;
@@ -117,32 +112,16 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
data->set &= ~ALTITUDE_SET;
}
if (data->set & SATELLITE_SET) {
-#ifdef HAVE_LIBGPS19
if(data->satellites_visible > 0) {
-#else
- if(data->satellites > 0) {
-#endif
sats_signal=0;
-#ifdef HAVE_LIBGPS19
for( i=0;i<data->satellites_visible;i++) {
-#else
- for( i=0;i<data->satellites;i++) {
-#endif
if (data->ss[i] > 0)
sats_signal++;
}
}
-#ifdef HAVE_LIBGPS19
if (priv->sats_used != data->satellites_used || priv->sats != data->satellites_visible || priv->sats_signal != sats_signal ) {
-#else
- if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) {
-#endif
priv->sats_used = data->satellites_used;
-#ifdef HAVE_LIBGPS19
priv->sats = data->satellites_visible;
-#else
- priv->sats = data->satellites;
-#endif
priv->sats_signal = sats_signal;
callback_list_call_attr_0(priv->cbl, attr_position_sats);
}
@@ -160,17 +139,10 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
priv->fix_time = data->fix.time;
data->set &= ~TIME_SET;
}
-#ifdef HAVE_LIBGPS19
if (data->set & DOP_SET) {
dbg(1, "pdop : %g\n", data->dop.pdop);
priv->hdop = data->dop.pdop;
data->set &= ~DOP_SET;
-#else
- if (data->set & PDOP_SET) {
- dbg(1, "pdop : %g\n", data->pdop);
- priv->hdop = data->hdop;
- data->set &= ~PDOP_SET;
-#endif
}
if (data->set & LATLON_SET) {
priv->geo.lat = data->fix.latitude;
@@ -205,31 +177,19 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv)
}
dbg(0,"Trying to connect to %s:%s\n",source+7,port?port:"default");
-#if GPSD_API_MAJOR_VERSION >= 5
/* gps_open returns 0 on success */
if (gps_open(source + 7, port, priv->gps)) {
-#else
- priv->gps = gps_open(source + 7, port);
- if(!priv->gps) {
-#endif
dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
g_free(source);
return TRUE;
}
g_free(source);
-#ifdef HAVE_LIBGPS19
if (strchr(priv->gpsd_query,'r'))
gps_stream(priv->gps, WATCH_ENABLE|WATCH_NMEA|WATCH_JSON, NULL);
else
gps_stream(priv->gps, WATCH_ENABLE|WATCH_JSON, NULL);
-#else
- gps_query(priv->gps, priv->gpsd_query);
-#endif
-#if GPSD_API_MAJOR_VERSION < 5
- gps_set_raw_hook(priv->gps, vehicle_gpsd_callback);
-#endif
priv->cb = callback_new_1(callback_cast(vehicle_gpsd_io), priv);
priv->cbt = callback_new_1(callback_cast(vehicle_gpsd_try_open), priv);
priv->evwatch = event_add_watch((void *)priv->gps->gps_fd, event_watch_cond_read, priv->cb);
@@ -291,9 +251,7 @@ vehicle_gpsd_close(struct vehicle_priv *priv)
}
if (priv->gps) {
gps_close(priv->gps);
-#if GPSD_API_MAJOR_VERSION >= 5
g_free(priv->gps);
-#endif
priv->gps = NULL;
}
#ifdef HAVE_GPSBT
@@ -311,7 +269,6 @@ vehicle_gpsd_io(struct vehicle_priv *priv)
dbg(1, "enter\n");
if (priv->gps) {
vehicle_last = priv;
-#if GPSD_API_MAJOR_VERSION >= 5
if(gps_read(priv->gps)==-1) {
dbg(0,"gps_poll failed\n");
vehicle_gpsd_close(priv);
@@ -322,13 +279,6 @@ vehicle_gpsd_io(struct vehicle_priv *priv)
buf = gps_data(priv->gps);
vehicle_gpsd_callback(priv->gps,buf,strlen(buf));
}
-#else
- if (gps_poll(priv->gps)) {
- dbg(0,"gps_poll failed\n");
- vehicle_gpsd_close(priv);
- vehicle_gpsd_open(priv);
- }
-#endif
}
}
@@ -340,9 +290,7 @@ vehicle_gpsd_destroy(struct vehicle_priv *priv)
g_free(priv->source);
if (priv->gpsd_query)
g_free(priv->gpsd_query);
-#if GPSD_API_MAJOR_VERSION >= 5
g_free(priv->gps);
-#endif
g_free(priv);
}
@@ -428,9 +376,7 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods
dbg(1, "enter\n");
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
-#if GPSD_API_MAJOR_VERSION >= 5
ret->gps = g_new0(struct gps_data_t, 1);
-#endif
ret->source = g_strdup(source->u.str);
query = attr_search(attrs, NULL, attr_gpsd_query);
if (query) {