      # check for C11 or better, and __STDC__NO_ATOMICS__ is not defined
      # before looking for stdatomic.h
      if ((config.CheckC11() and
-@@ -1295,6 +1304,7 @@ libgpsd_sources = [
+@@ -1407,6 +1416,7 @@ libgpsd_sources = [
      "driver_nmea0183.c",
      "driver_nmea2000.c",
      "driver_oncore.c",

 
 ssize_t gpsd_write(struct gps_device_t *session,
 		   const char *buf,
@@ -366,6 +369,11 @@ void gpsd_deactivate(struct gps_device_t *session)
         (void)nmea2000_close(session);
     else
 #endif /* of defined(NMEA2000_ENABLE) */

+		session->lexer.outbuflen = 0;
+		return 1;
+	} else if (ret < 0) {
+		GPSD_LOG(LOG_ERROR, &session->context->errout,
+			 "QRTR get: Unable to receive packet.\n");
+		return -1;
+	}
