summaryrefslogtreecommitdiff
path: root/gpsctl.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-09 23:50:33 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-09 23:50:33 -0400
commitf46a379b6c3e70b13f9c34eb5b182ad41370cbdc (patch)
treeb16dece5024164506d3a5ea7c8e174c03e9dc58d /gpsctl.c
parentb997850f8a5e0b8abdfa873272c9ab72b0fb274e (diff)
downloadgpsd-f46a379b6c3e70b13f9c34eb5b182ad41370cbdc.tar.gz
Add some new mechanism.
Diffstat (limited to 'gpsctl.c')
-rw-r--r--gpsctl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gpsctl.c b/gpsctl.c
index 1740f508..a02d5bee 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -62,6 +62,13 @@ static void settle(struct gps_device_t *session)
(void)tcdrain(session->gpsdata.gps_fd);
}
+/*
+ * Allows any response other than ERROR. Use it for queries where a
+ * failure return (due to, for example, a missing driver method) is
+ * immediate, but successful responses have unpredictable lag.
+ */
+#define NON_ERROR 0 /* must be distinct from any gps_mask_t value */
+
static bool gps_query(/*@out@*/struct gps_data_t *gpsdata,
gps_mask_t expect,
const int timeout,
@@ -131,7 +138,7 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata,
}
/*@ +ignorequals @*/
- if ((expect & gpsdata->set) != 0)
+ if ((expect == NON_ERROR) || (expect & gpsdata->set) != 0)
return true;
else if (time(NULL) - starttime > timeout) {
gpsd_report(context.debug, LOG_ERROR,