From 5579b15071314752b053daa03ff62354809364e4 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Sat, 21 Nov 2015 11:16:05 +0100 Subject: [PATCH] gps: make plugin compatible with older libgps versions --- src/gps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gps.c b/src/gps.c index 944932ab..d0937c98 100644 --- a/src/gps.c +++ b/src/gps.c @@ -74,7 +74,11 @@ static void * cgps_thread (void * pData) { err_count = 0; +#if GPSD_API_MAJOR_VERSION > 4 int status = gps_open (config.host, config.port, &conn); +#else + int status = gps_open_r (config.host, config.port, &conn); +#endif if (status < 0) { WARNING ("gps plugin: Connecting to %s:%s failed: %s", @@ -88,8 +92,12 @@ static void * cgps_thread (void * pData) while (1) { +#if GPSD_API_MAJOR_VERSION > 4 long timeout_ms = CDTIME_T_TO_MS (config.timeout); if (!gps_waiting (&conn, (int) timeout_ms)) +#else + if (!gps_waiting (&conn)) +#endif { struct timespec pause_ns; CDTIME_T_TO_TIMESPEC (config.pause, &pause_ns); -- 2.30.2