mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 23:32:14 +02:00
gnss: Gracefully handle failure to access xtra data file
This commit is contained in:
17
src/gnss.c
17
src/gnss.c
@@ -271,13 +271,19 @@ static void init_assistance_data_upload_start(struct EG25Manager *manager,
|
|||||||
const char *response)
|
const char *response)
|
||||||
{
|
{
|
||||||
gchar value[BUFFER_SIZE];
|
gchar value[BUFFER_SIZE];
|
||||||
long int size;
|
off_t size;
|
||||||
|
|
||||||
/* Process AT response */
|
/* Process AT response */
|
||||||
at_process_result(manager, response);
|
at_process_result(manager, response);
|
||||||
|
|
||||||
/* Get file size in bytes */
|
/* Get file size in bytes */
|
||||||
size = (long int)lseek(manager->gnss_assistance_fd, 0, SEEK_END);
|
size = lseek(manager->gnss_assistance_fd, 0, SEEK_END);
|
||||||
|
if (size == -1) {
|
||||||
|
g_critical("gnss: unable to read size of xtra data file: %s", g_strerror(errno));
|
||||||
|
|
||||||
|
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
|
||||||
|
return;
|
||||||
|
}
|
||||||
lseek(manager->gnss_assistance_fd, 0, SEEK_SET);
|
lseek(manager->gnss_assistance_fd, 0, SEEK_SET);
|
||||||
|
|
||||||
/* Start upload */
|
/* Start upload */
|
||||||
@@ -308,7 +314,12 @@ static void upload_assistance_data(struct EG25Manager *manager)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (fstat(manager->gnss_assistance_fd, &sb) != 0) {
|
if (fstat(manager->gnss_assistance_fd, &sb) != 0) {
|
||||||
g_error("Unable to upload xtra data: %s", g_strerror(errno));
|
g_critical("gnss: unable to stat xtra data file: %s", g_strerror(errno));
|
||||||
|
|
||||||
|
/* Make sure the upload times out and the modem goes back to AT command mode */
|
||||||
|
sleep(UPLOAD_TIMEOUT_S + 1);
|
||||||
|
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
Reference in New Issue
Block a user