summaryrefslogtreecommitdiff
path: root/cgps.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-03-12 13:00:44 -0700
committerGary E. Miller <gem@rellim.com>2015-03-12 13:00:44 -0700
commit4b40cd6d35057d9e0e1f423882315b7f8945a751 (patch)
tree3ed5a7d55f82f8443a977d206688588694dd5615 /cgps.c
parentcfd75178762a5b8f27c758bb97d8e58c66172c9e (diff)
downloadgpsd-4b40cd6d35057d9e0e1f423882315b7f8945a751.tar.gz
Increase timeout for cgps from 5 Sec to 120 Sec.
Allow user input every 1/2 second wwheil waiting.
Diffstat (limited to 'cgps.c')
-rw-r--r--cgps.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cgps.c b/cgps.c
index a470745b..24b5a748 100644
--- a/cgps.c
+++ b/cgps.c
@@ -807,10 +807,15 @@ int main(int argc, char *argv[])
/* heart of the client */
for (;;) {
int c;
+ int wait_clicks = 0; /* cycles to wait before gpsd timeout */
- if (!gps_waiting(&gpsdata, 5000000)) {
- die(GPS_TIMEOUT);
+ /* wait 1/2 second for gpsd */
+ if (!gps_waiting(&gpsdata, 500000)) {
+ /* 240 tries at .5 Sec a try is a 2 minute timeout */
+ if ( 120 < wait_clicks++ )
+ die(GPS_TIMEOUT);
} else {
+ wait_clicks = 0;
errno = 0;
if (gps_read(&gpsdata) == -1) {
fprintf(stderr, "cgps: socket error 4\n");