From 415f68a8f66df504a7d5b6337b6765af3fe57695 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 3 May 2014 23:03:13 +0200 Subject: gps: Abort thread only after two consecutive poll failures Signed-off-by: Paul Kocialkowski --- gps/gta04_gps.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gps/gta04_gps.c') 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); -- cgit v1.2.3