fix build with newer gpsd API

OK sthen@
This commit is contained in:
kirby 2020-05-26 15:36:54 +00:00
parent c9a6453eb5
commit e3d3a700f9
2 changed files with 34 additions and 7 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.34 2020/03/20 16:44:23 naddy Exp $
# $OpenBSD: Makefile,v 1.35 2020/05/26 15:36:54 kirby Exp $
COMMENT = garmin GPS map management tool
DISTNAME = qlandkartegt-1.8.1
CATEGORIES = geo x11
REVISION = 4
REVISION = 5
HOMEPAGE = http://www.qlandkarte.org/
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=qlandkartegt/}

View File

@ -1,18 +1,45 @@
$OpenBSD: patch-src_CDeviceGPSD_cpp,v 1.1 2019/07/31 12:37:53 kirby Exp $
$OpenBSD: patch-src_CDeviceGPSD_cpp,v 1.2 2020/05/26 15:36:54 kirby Exp $
Fix build with newer gpsd API.
Index: src/CDeviceGPSD.cpp
--- src/CDeviceGPSD.cpp.orig
+++ src/CDeviceGPSD.cpp
@@ -212,7 +212,9 @@ void CGPSDThread::run()
@@ -212,10 +212,10 @@ void CGPSDThread::run()
} // if
else if( FD_ISSET( gpsdata->gps_fd, &fds ) )
{
-#if GPSD_API_MAJOR_VERSION >= 5
- gps_read( gpsdata );
+#if GPSD_API_MAJOR_VERSION >= 7
+ gps_read( gpsdata, NULL, 0 );
+#elif GPSD_API_MAJOR_VERSION >= 5
gps_read( gpsdata );
#else
gps_poll( gpsdata );
- gps_poll( gpsdata );
+ gps_read( gpsdata );
#endif
if( !decodeData() ) break;
} // else if
@@ -233,7 +233,11 @@ void CGPSDThread::run()
bool CGPSDThread::decodeData()
{
// see, if it's interesting
+#if GPSD_API_MAJOR_VERSION >= 9
+ if( gpsdata->fix.time.tv_sec == 0 )
+#else
if( gpsdata->fix.time == 0 )
+#endif
return true;
static const gps_mask_t interesting_mask = TIME_SET | LATLON_SET
| ALTITUDE_SET | SPEED_SET | TRACK_SET | STATUS_SET | MODE_SET
@@ -263,7 +267,11 @@ bool CGPSDThread::decodeData()
current_log.lon = gpsdata->fix.longitude;
current_log.lat = gpsdata->fix.latitude;
current_log.ele = gpsdata->fix.altitude;
+#if GPSD_API_MAJOR_VERSION >= 9
+ current_log.timestamp = gpsdata->fix.time.tv_sec;
+#else
current_log.timestamp = gpsdata->fix.time;
+#endif
current_log.error_horz = gpsdata->fix.epx;
current_log.error_vert = gpsdata->fix.epv;
current_log.heading = gpsdata->fix.track;