mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 23:32:14 +02:00
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:
3
src/at.c
3
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
|
||||
|
11
src/gnss.c
11
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;
|
||||
|
Reference in New Issue
Block a user