gnss: fix close gps block
Change-Id: Ia60e2dfde5c9b912f7423f68070265f314e3990c
diff --git a/mbtk/mbtk_gnssd/gnss_main.c b/mbtk/mbtk_gnssd/gnss_main.c
index 49adf98..5b60d93 100755
--- a/mbtk/mbtk_gnssd/gnss_main.c
+++ b/mbtk/mbtk_gnssd/gnss_main.c
@@ -384,11 +384,7 @@
fd_set fdr, fdw;
int fd_max = 0;
- FD_ZERO(&fdw);
- FD_ZERO(&fdr);
- FD_SET(gnss_info.fd, &fdr);
fd_max = (gnss_info.fd > fd_max) ? gnss_info.fd : fd_max;
- FD_SET(gnss_info.exit_fd[0], &fdr);
fd_max = (gnss_info.exit_fd[0] > fd_max) ? gnss_info.exit_fd[0] : fd_max;
memset(nmea_buff, 0, sizeof(nmea_buff));
memset(data_buff, 0, sizeof(data_buff));
@@ -411,6 +407,10 @@
LOGD("uart_fd - %d, exit_fd - %d", gnss_info.fd, gnss_info.exit_fd[0]);
while(gnss_info.state >= GNSS_STATE_OPEN) {
+ FD_ZERO(&fdw);
+ FD_ZERO(&fdr);
+ FD_SET(gnss_info.fd, &fdr);
+ FD_SET(gnss_info.exit_fd[0], &fdr);
ret = select(fd_max + 1, &fdr, &fdw, 0, NULL);
//LOGD("select - %d", ret);
if(gnss_info.state < GNSS_STATE_OPEN) {