From a06522f9b67911b0dae606369a76ce5f3cd4c9c4 Mon Sep 17 00:00:00 2001 From: Robert Norris Date: Sun, 5 Mar 2017 23:16:09 +0000 Subject: [PATCH] Allow test_gpsmm to connect via shared memory Simply skip calling gps_stream() which is only for socket connections. TESTED: test_gpsmm can connect to gpsd shared memory on Linux. Signed-off-by: Fred Wright --- test_gpsmm.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test_gpsmm.cpp b/test_gpsmm.cpp index 8379c0e0..4106b476 100644 --- a/test_gpsmm.cpp +++ b/test_gpsmm.cpp @@ -141,9 +141,12 @@ int main(int argc, char *argv[]) //gpsmm gps_rec("localhost", DEFAULT_GPSD_PORT); gpsmm gps_rec(source.server, source.port); - if (gps_rec.stream(WATCH_ENABLE|WATCH_JSON) == NULL) { - cerr << "No GPSD running.\n"; - return 1; + if ( !((std::string)source.server == (std::string)GPSD_SHARED_MEMORY || + (std::string)source.server == (std::string)GPSD_DBUS_EXPORT) ) { + if (gps_rec.stream(WATCH_ENABLE|WATCH_JSON) == NULL) { + cerr << "No GPSD running.\n"; + return 1; + } } // Loop for the specified number of times