summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-05-03 23:03:13 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-05-03 23:03:13 +0200
commit415f68a8f66df504a7d5b6337b6765af3fe57695 (patch)
tree2e5503e8f606210ceabbcb9a9f6fec8e2ca5630c
parentd1f1c82ad66a22bf8de04c395821416847cb9135 (diff)
downloaddevice_goldelico_gta04-415f68a8f66df504a7d5b6337b6765af3fe57695.zip
device_goldelico_gta04-415f68a8f66df504a7d5b6337b6765af3fe57695.tar.gz
device_goldelico_gta04-415f68a8f66df504a7d5b6337b6765af3fe57695.tar.bz2
gps: Abort thread only after two consecutive poll failures
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--gps/gta04_gps.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gps/gta04_gps.c b/gps/gta04_gps.c
index 21a8195..62a45bc 100644
--- a/gps/gta04_gps.c
+++ b/gps/gta04_gps.c
@@ -545,7 +545,11 @@ void gta04_gps_thread(void *data)
rc = select(fd_max + 1, &fds, NULL, NULL, timeout);
if (rc < 0) {
ALOGE("Polling failed");
- break;
+
+ if (failures)
+ break;
+ else
+ failures++;
} else if (rc == 0 && gta04_gps->status.status == GPS_STATUS_ENGINE_ON) {
ALOGE("Not receiving anything from the GPS");
gta04_gps_event_write(GTA04_GPS_EVENT_RESTART);