diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2016-12-08 12:43:31 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 11:24:14 +0100 |
commit | 899fd165ff02bc240c618ad39f6ad66957f69740 (patch) | |
tree | 99402fb70055f2d558682aa33d433ce196bd1a1c | |
parent | ca44b38814fabbd3d8621acc1049157e64dd074c (diff) | |
download | libqmi-899fd165ff02bc240c618ad39f6ad66957f69740.tar.gz |
qmi-firmware-update: don't try to download if modem doesn't need it
If modem reports that there is nothing to download, it means it already
has the specified firmware/config versions running, so nothing to do.
Don't try to do offline/reset in that case because we'll end up in
normal mode again, not in QDL download mode.
-rw-r--r-- | src/qmi-firmware-update/qfu-updater.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c index 06dfe0c9..52d190af 100644 --- a/src/qmi-firmware-update/qfu-updater.c +++ b/src/qmi-firmware-update/qfu-updater.c @@ -441,6 +441,12 @@ qmi_client_release_ready (QmiDevice *device, g_clear_object (&ctx->qmi_device); g_clear_object (&ctx->cdc_wdm_file); + /* If nothing to download, we're done */ + if (!ctx->pending_images) { + run_context_step_next (task, RUN_CONTEXT_STEP_LAST); + return; + } + /* Go on */ run_context_step_next (task, ctx->step + 1); } @@ -592,6 +598,7 @@ set_firmware_preference_ready (QmiClientDms *client, QmiMessageDmsSetFirmwarePreferenceOutput *output; GError *error = NULL; GArray *array = NULL; + guint next_step; ctx = (RunContext *) g_task_get_task_data (task); @@ -611,10 +618,16 @@ set_firmware_preference_ready (QmiClientDms *client, return; } + /* We'll go to next step, unless told to finish early */ + next_step = ctx->step + 1; + /* list images we need to download? */ if (qmi_message_dms_set_firmware_preference_output_get_image_download_list (output, &array, &error)) { if (!array->len) { - g_debug ("[qfu-updater] no more images needed to download"); + g_print ("device already reports the given firmware/config version: nothing to do\n"); + g_list_free_full (ctx->pending_images, (GDestroyNotify) g_object_unref); + ctx->pending_images = NULL; + next_step = RUN_CONTEXT_STEP_CLEANUP_QMI_DEVICE; } else { GString *images = NULL; QmiDmsFirmwareImageType type; @@ -636,7 +649,7 @@ set_firmware_preference_ready (QmiClientDms *client, qmi_message_dms_set_firmware_preference_output_unref (output); /* Go on */ - run_context_step_next (task, ctx->step + 1); + run_context_step_next (task, next_step); } static void |