aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-10-29 18:17:04 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-10-29 18:17:04 +0100
commit2910b783051aa5059aeb370b164a1ee82ac3095c (patch)
tree03405c2b807f8f3b2379ed1e9693650b09cf98d7
parent9c75c387c04175298d7fae3dd432d84bd622fccd (diff)
{oc2g,sysmo}-mgr-calib: Fix build against gpsd >= 3.18
-rw-r--r--src/osmo-bts-oc2g/misc/oc2gbts_mgr_calib.c12
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c13
2 files changed, 22 insertions, 3 deletions
diff --git a/src/osmo-bts-oc2g/misc/oc2gbts_mgr_calib.c b/src/osmo-bts-oc2g/misc/oc2gbts_mgr_calib.c
index 96162621..104d2792 100644
--- a/src/osmo-bts-oc2g/misc/oc2gbts_mgr_calib.c
+++ b/src/osmo-bts-oc2g/misc/oc2gbts_mgr_calib.c
@@ -69,6 +69,16 @@ enum calib_result {
CALIB_SUCCESS,
};
+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);
+#else
+ return gps_read(data);
+#endif
+}
+
static int oc2gbts_par_get_uptime(void *ctx, int *ret)
{
char *fpath;
@@ -173,7 +183,7 @@ static int mgr_gps_read(struct osmo_fd *fd, unsigned int what)
int rc;
struct oc2gbts_mgr_instance *mgr = fd->data;
- rc = gps_read(&mgr->gps.gpsdata);
+ rc = compat_gps_read(&mgr->gps.gpsdata);
if (rc == -1) {
LOGP(DCALIB, LOGL_ERROR, "gpsd vanished during read.\n");
calib_state_reset(mgr, CALIB_FAIL_GPSFIX);
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c
index 62509f2a..b0b5edd8 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c
@@ -57,6 +57,16 @@ enum calib_result {
CALIB_SUCESS,
};
+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);
+#else
+ return gps_read(data);
+#endif
+}
+
static void calib_loop_run(void *_data)
{
int rc;
@@ -109,8 +119,7 @@ static int mgr_gps_read(struct osmo_fd *fd, unsigned int what)
{
int rc;
struct sysmobts_mgr_instance *mgr = fd->data;
-
- rc = gps_read(&mgr->calib.gpsdata);
+ rc = compat_gps_read(&mgr->calib.gpsdata);
if (rc == -1) {
LOGP(DCALIB, LOGL_ERROR, "gpsd vanished during read.\n");
calib_state_reset(mgr, CALIB_FAIL_GPS);