Fix build against gpsd >= 3.20 #1

Merged
osmith merged 2 commits from osmith/gpsdate:osmith/wip into master 2022-12-15 09:23:20 +00:00
Member
The previous version was written against gpsd 3.10. This also makes the
date more precise, previously microseconds were set to 0.
    
Related: SYS#6222

Note that in meta-sysmocom-bsp, we have the commit hardcoded. It won't automatically try to build the new version after merge.

``` The previous version was written against gpsd 3.10. This also makes the date more precise, previously microseconds were set to 0. Related: SYS#6222 ``` Note that in meta-sysmocom-bsp, we have the [commit hardcoded](https://gitea.sysmocom.de/sysmo-bts/meta-sysmocom-bsp/src/branch/201705/recipes-extra/gpsdate/gpsdate_git.bb#L15). It won't automatically try to build the new version after merge.
osmith added 1 commit 2022-12-14 13:18:13 +00:00
pespin requested changes 2022-12-14 16:25:25 +00:00
gps-watchdog.c Outdated
@ -42,6 +42,10 @@
#include <gps.h>
#if GPSD_API_MAJOR_VERSION < 11
Member

I'd rather keep supporting older versions by means of ifdef in relevant code parts, or having a function helper defined for different versions. IIRC we are already doing that in some places?

I'd rather keep supporting older versions by means of ifdef in relevant code parts, or having a function helper defined for different versions. IIRC we are already doing that in some places?
Owner

I agree. the tool is a generic open source tool we released (and also announced on the gpsd mailing list when it was created). So we shouldn't constrain it to support only the absolutely latest gpsd client/API versions, but maintain compatibility.

I agree. the tool is a generic open source tool we released (and also announced on the gpsd mailing list when it was created). So we shouldn't constrain it to support only the absolutely latest gpsd client/API versions, but maintain compatibility.
Author
Member

Done

Done
osmith marked this conversation as resolved
osmith force-pushed osmith/wip from d28feb6cb2 to 54593d77f8 2022-12-14 18:03:01 +00:00 Compare
osmith requested review from pespin 2022-12-14 18:04:03 +00:00
pespin approved these changes 2022-12-14 18:16:44 +00:00
gps-watchdog.c Outdated
@ -120,7 +125,11 @@ static int my_gps_mainloop(struct gps_data_t *gdata,
if (!gps_waiting(gdata, timeout)) {
return -1;
} else {
#if GPSD_API_MAJOR_VERSION >= 7
Member

For this gps_read() function since we always call it with one "variable" param in then, the best is to do a shim. I recall doing that somewhere already in gpsdata or gpsd in the past, look around. Something like:

int compat_gps_read(one_param) {
#if GPSD_API_MAJOR_VERSION >= 7
return gps_read(gdata, NULL, 0);
#else
return gps_read(gdata);
#endif
}

and then use compat_gps_read in all places.

For this gps_read() function since we always call it with one "variable" param in then, the best is to do a shim. I recall doing that somewhere already in gpsdata or gpsd in the past, look around. Something like: int compat_gps_read(one_param) { #if GPSD_API_MAJOR_VERSION >= 7 return gps_read(gdata, NULL, 0); #else return gps_read(gdata); #endif } and then use compat_gps_read in all places.
Author
Member
Done, found it here: https://gerrit.osmocom.org/c/osmocom-bb/+/11609
osmith marked this conversation as resolved
osmith force-pushed osmith/wip from 54593d77f8 to 68bcf620b4 2022-12-14 18:26:46 +00:00 Compare
osmith requested review from pespin 2022-12-14 18:27:31 +00:00
pespin approved these changes 2022-12-14 18:34:52 +00:00
osmith merged commit 68bcf620b4 into master 2022-12-15 09:23:20 +00:00
osmith deleted branch osmith/wip 2022-12-15 10:42:19 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sysmocom/gpsdate#1
No description provided.