diff --git a/src/at.c b/src/at.c index 5c35844..a6cb7e0 100644 --- a/src/at.c +++ b/src/at.c @@ -289,8 +289,9 @@ static gboolean modem_response(gint fd, /* * Successful AT responses contain 'OK', except for AT+QFUPL which also * returns 'CONNECT' when the modem is ready to receive data over serial + * and '+QFUPL:...' when data upload is complete */ - else if (strstr(response, "OK") || strstr(response, "CONNECT")) { + else if (strstr(response, "OK") || strstr(response, "CONNECT") || strstr(response, "QFUPL")) { if (manager->at_callback != NULL) manager->at_callback(manager, response); else diff --git a/src/gnss.c b/src/gnss.c index a71ba1e..d95f071 100644 --- a/src/gnss.c +++ b/src/gnss.c @@ -273,6 +273,12 @@ static void init_assistance_data_upload_ready(struct EG25Manager *manager, /* Search for 'CONNECT' in response to start upload */ if (strstr(response, "CONNECT")) { g_message("Modem ready for GNSS assistance data upload"); + manager->gnss_assistance_step++; + gnss_step(manager); + } else if (strstr(response, "QFUPL")) { + /* Clear QFUPL AT command and process next */ + at_next_command(manager); + manager->gnss_assistance_step++; gnss_step(manager); } @@ -341,14 +347,9 @@ static void upload_assistance_data(struct EG25Manager *manager) usleep(UPLOAD_DELAY_US); } while ((!error && written_total < sb.st_size) || (ret == -1 && error == EAGAIN)); - /* Clear QFUPL AT command and process next */ - at_next_command(manager); - /* Go to the next step if successful */ if (!error) { g_message("Successfully uploaded %ld bytes to the modem", written_total); - manager->gnss_assistance_step++; - gnss_step(manager); } else { g_critical("Unable to upload xtra data: %s", g_strerror(error)); manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;