diff options
-rw-r--r-- | SConstruct | 3 | ||||
-rw-r--r-- | gpsctl.c | 2 | ||||
-rw-r--r-- | gpsd.c | 15 | ||||
-rw-r--r-- | gpsdecode.c | 2 | ||||
-rw-r--r-- | libgps_core.c | 23 |
5 files changed, 37 insertions, 8 deletions
@@ -1545,6 +1545,9 @@ if env['socket_export']: # offset from subframe data. Utility('gps-makeregress', [gpsd, python_built_extensions], '$SRCDIR/regress-driver -b test/daemon/*.log') +else: + gps_regress = Utility("gps-regress", [], + "echo 'gps-regress: socket export disabled'") # To build an individual test for a load named foo.log, put it in # test/daemon and do this: @@ -36,6 +36,7 @@ static bool hunting = true; */ #define REDIRECT_SNIFF 15 +#if defined(RECONFIGURE_ENABLE) || defined(CONTROLSEND_ENABLE) static void settle(struct gps_device_t *session) /* allow the device to settle after a control operation */ { @@ -46,6 +47,7 @@ static void settle(struct gps_device_t *session) (void)usleep(50000); (void)tcdrain(session->gpsdata.gps_fd); } +#endif /* defined(RECONFIGURE_ENABLE) || defined(CONTROLSEND_ENABLE) */ /* * Allows any response other than ERROR. Use it for queries where a @@ -156,6 +156,7 @@ static int sd_socket_count = 0; #endif #endif +#define UNALLOCATED_FD -1 static volatile sig_atomic_t signalled; @@ -536,8 +537,6 @@ struct subscriber_t static struct subscriber_t subscribers[MAXSUBSCRIBERS]; /* indexed by client file descriptor */ -#define UNALLOCATED_FD -1 - static void lock_subscriber(struct subscriber_t *sub) { (void)pthread_mutex_lock(&sub->mutex); @@ -1773,7 +1772,12 @@ static void netgnss_autoconnect(struct gps_context_t *context, } #endif /* __UNUSED_AUTOCONNECT__ */ -static void gpsd_terminate(struct gps_context_t *context) +#ifdef PPS_ENABLE +#define CONDITIONALLY_UNUSED +#else +#define CONDITIONALLY_UNUSED UNUSED +#endif /* PPS_ENABLE */ +static void gpsd_terminate(struct gps_context_t *context CONDITIONALLY_UNUSED) /* finish cleanly, reverting device configuration */ { int dfd; @@ -1796,9 +1800,12 @@ int main(int argc, char *argv[]) static char *gpsd_service = NULL; /* this static pacifies splint */ struct subscriber_t *sub; #endif /* SOCKET_EXPORT_ENABLE */ + fd_set rfds; +#ifdef CONTROL_SOCKET_ENABLE + fd_set control_fds; +#endif /* CONTROL_SOCKET_ENABLE */ #ifdef CONTROL_SOCKET_ENABLE static socket_t csock; - fd_set control_fds, rfds; socket_t cfd; static char *control_socket = NULL; #endif /* CONTROL_SOCKET_ENABLE */ diff --git a/gpsdecode.c b/gpsdecode.c index abf154c2..02558ab0 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -515,7 +515,9 @@ static void decode(FILE *fpin, FILE*fpout) struct gps_device_t session; struct gps_context_t context; struct policy_t policy; +#if defined(SOCKET_EXPORT_ENABLE) || defined(AIVDM_ENABLE) char buf[GPS_JSON_RESPONSE_MAX * 4]; +#endif //This looks like a good idea, but it breaks regression tests //(void)strlcpy(session.gpsdata.dev.path, "stdin", sizeof(session.gpsdata.dev.path)); diff --git a/libgps_core.c b/libgps_core.c index 42c5051c..d481e699 100644 --- a/libgps_core.c +++ b/libgps_core.c @@ -75,6 +75,7 @@ int gps_open(/*@null@*/const char *host, else if (status == -2) status = SHM_NOATTACH; } +#define USES_HOST #endif /* SHM_EXPORT_ENABLE */ #ifdef DBUS_EXPORT_ENABLE @@ -83,14 +84,21 @@ int gps_open(/*@null@*/const char *host, if (status != 0) status = DBUS_FAILURE; } +#define USES_HOST #endif /* DBUS_EXPORT_ENABLE */ #ifdef SOCKET_EXPORT_ENABLE if (status == -1) { status = gps_sock_open(host, port, gpsdata); } +#define USES_HOST #endif /* SOCKET_EXPORT_ENABLE */ +#ifndef USES_HOST + fprintf(stderr, "No methods available for connnecting to %s!\n", host); +#endif /* USES_HOST */ +#undef USES_HOST + gpsdata->set = 0; gpsdata->status = STATUS_NO_FIX; gpsdata->satellites_used = 0; @@ -101,7 +109,13 @@ int gps_open(/*@null@*/const char *host, /*@ +branchstate +compdef @*/ } -int gps_close(struct gps_data_t *gpsdata) +#if defined(SHM_EXPORT_ENABLE) || defined(SOCKET_EXPORT_ENABLE) +#define CONDITIONALLY_UNUSED +#else +#define CONDITIONALLY_UNUSED UNUSED +#endif + +int gps_close(struct gps_data_t *gpsdata CONDITIONALLY_UNUSED) /* close a gpsd connection */ { int status = -1; @@ -124,7 +138,7 @@ int gps_close(struct gps_data_t *gpsdata) return status; } -int gps_read(struct gps_data_t *gpsdata) +int gps_read(struct gps_data_t *gpsdata CONDITIONALLY_UNUSED) /* read from a gpsd connection */ { int status = -1; @@ -221,8 +235,9 @@ bool gps_waiting(const struct gps_data_t *gpsdata CONDITIONALLY_UNUSED, int time return waiting; } -int gps_mainloop(struct gps_data_t *gpsdata, int timeout, - void (*hook)(struct gps_data_t *gpsdata)) +int gps_mainloop(struct gps_data_t *gpsdata CONDITIONALLY_UNUSED, + int timeout CONDITIONALLY_UNUSED, + void (*hook)(struct gps_data_t *gpsdata) CONDITIONALLY_UNUSED) { int status = -1; |