gnss: wait for the modem to confirm upload success

If we clear QFUPL right after we finished the file transfer, we will
execute the following commands right away, leading to interleaved
replies from the modem (i.e. the reply to QGPSXTRATIME being received
with the notification of upload completion).

Keeping the command in the queue allows us to use the callback a second
time once the upload is complete and resume assistance data processing
accordingly.
This commit is contained in:
Arnaud Ferraris
2021-10-06 01:48:43 +02:00
parent 66073cdd21
commit 73868260a2
2 changed files with 8 additions and 6 deletions

View File

@@ -289,8 +289,9 @@ static gboolean modem_response(gint fd,
/* /*
* Successful AT responses contain 'OK', except for AT+QFUPL which also * Successful AT responses contain 'OK', except for AT+QFUPL which also
* returns 'CONNECT' when the modem is ready to receive data over serial * 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) if (manager->at_callback != NULL)
manager->at_callback(manager, response); manager->at_callback(manager, response);
else else

View File

@@ -273,6 +273,12 @@ static void init_assistance_data_upload_ready(struct EG25Manager *manager,
/* Search for 'CONNECT' in response to start upload */ /* Search for 'CONNECT' in response to start upload */
if (strstr(response, "CONNECT")) { if (strstr(response, "CONNECT")) {
g_message("Modem ready for GNSS assistance data upload"); 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++; manager->gnss_assistance_step++;
gnss_step(manager); gnss_step(manager);
} }
@@ -341,14 +347,9 @@ static void upload_assistance_data(struct EG25Manager *manager)
usleep(UPLOAD_DELAY_US); usleep(UPLOAD_DELAY_US);
} while ((!error && written_total < sb.st_size) || (ret == -1 && error == EAGAIN)); } 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 */ /* Go to the next step if successful */
if (!error) { if (!error) {
g_message("Successfully uploaded %ld bytes to the modem", written_total); g_message("Successfully uploaded %ld bytes to the modem", written_total);
manager->gnss_assistance_step++;
gnss_step(manager);
} else { } else {
g_critical("Unable to upload xtra data: %s", g_strerror(error)); g_critical("Unable to upload xtra data: %s", g_strerror(error));
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST; manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;