summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-11-05 20:22:45 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-11-05 20:22:45 +0100
commit4f85fb30bc77e4bb4c3b9187a48a0a5a0a8cbb5a (patch)
tree58fc0aa97908342839197c4be3a228a9d78fb602 /src
parent9cdee8f66afce47a8f9c0500b1be90cc247dc697 (diff)
layer23: Fix build against gpsd >= 3.18
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/src/common/gps.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/host/layer23/src/common/gps.c b/src/host/layer23/src/common/gps.c
index 3ec7377..35ee416 100644
--- a/src/host/layer23/src/common/gps.c
+++ b/src/host/layer23/src/common/gps.c
@@ -60,9 +60,20 @@ static struct gps_data_t* gdata = NULL;
#if GPSD_API_MAJOR_VERSION >= 5
static struct gps_data_t _gdata;
-#define gps_poll gps_read
#endif
+static inline int compat_gps_read(struct gps_data_t *data)
+{
+/* API break in gpsd 6bba8b329fc7687b15863d30471d5af402467802 */
+#if GPSD_API_MAJOR_VERSION >= 7 && GPSD_API_MINOR_VERSION >= 0
+ return gps_read(data, NULL, 0);
+#elif GPSD_API_MAJOR_VERSION >= 5
+ return gps_read(data);
+#else
+ return gps_poll(data);
+#endif
+}
+
int osmo_gpsd_cb(struct osmo_fd *bfd, unsigned int what)
{
struct tm *tm;
@@ -85,7 +96,7 @@ int osmo_gpsd_cb(struct osmo_fd *bfd, unsigned int what)
#endif
/* polling returned an error */
- if (gps_poll(gdata))
+ if (compat_gps_read(gdata))
goto gps_not_ready;
/* data are valid */