diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 21:25:03 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 22:16:38 +0100 |
commit | 2e50146039089c61e11cea2f7c9b4125df4bfe19 (patch) | |
tree | ddfe8937de59ed7b8346268c644ef2e63f34a4af | |
parent | fc76dd4c2c01453eecffa5062bffeb9eb42985ea (diff) | |
download | external_libqmi-2e50146039089c61e11cea2f7c9b4125df4bfe19.zip external_libqmi-2e50146039089c61e11cea2f7c9b4125df4bfe19.tar.gz external_libqmi-2e50146039089c61e11cea2f7c9b4125df4bfe19.tar.bz2 |
qmi-firmware-update: new --override-download option
The Set Firmware Preference command may return an empty list of images
to be downloaded. If that happens and we just power cycle, we won't get
into QDL download mode, the module will just apply the new firmware
selection preference.
With the new --override-download option, we tell the module that even if
we already have the images, we want to perform the download.
This option doesn't apply to older SWI9200 devices as these don't have
any firmware preference setting. The option is implicit for these
devices, though, the download always happens.
-rw-r--r-- | src/qmi-firmware-update/qfu-main.c | 6 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-operation-update.c | 2 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-operation.h | 1 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-updater.c | 11 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-updater.h | 1 |
5 files changed, 20 insertions, 1 deletions
diff --git a/src/qmi-firmware-update/qfu-main.c b/src/qmi-firmware-update/qfu-main.c index 5cc2a2b..81ed304 100644 --- a/src/qmi-firmware-update/qfu-main.c +++ b/src/qmi-firmware-update/qfu-main.c @@ -56,6 +56,7 @@ static gchar *carrier_str; static gboolean device_open_proxy_flag; static gboolean device_open_mbim_flag; static gboolean ignore_version_errors_flag; +static gboolean override_download_flag; static gboolean skip_validation_flag; /* Reset */ @@ -212,6 +213,10 @@ static GOptionEntry context_update_entries[] = { "Run update operation even with version string errors.", NULL }, + { "override-download", 0, 0, G_OPTION_ARG_NONE, &override_download_flag, + "Download images even if module says it already has them.", + NULL + }, { "skip-validation", 0, 0, G_OPTION_ARG_NONE, &skip_validation_flag, "Don't wait to validate the running firmware after update.", NULL @@ -557,6 +562,7 @@ int main (int argc, char **argv) device_open_proxy_flag, device_open_mbim_flag, ignore_version_errors_flag, + override_download_flag, skip_validation_flag); goto out; } diff --git a/src/qmi-firmware-update/qfu-operation-update.c b/src/qmi-firmware-update/qfu-operation-update.c index f079c8d..c81ec6d 100644 --- a/src/qmi-firmware-update/qfu-operation-update.c +++ b/src/qmi-firmware-update/qfu-operation-update.c @@ -124,6 +124,7 @@ qfu_operation_update_run (const gchar **images, gboolean device_open_proxy, gboolean device_open_mbim, gboolean ignore_version_errors, + gboolean override_download, gboolean skip_validation) { QfuUpdater *updater = NULL; @@ -138,6 +139,7 @@ qfu_operation_update_run (const gchar **images, device_open_proxy, device_open_mbim, ignore_version_errors, + override_download, skip_validation); result = operation_update_run (updater, images); g_object_unref (updater); diff --git a/src/qmi-firmware-update/qfu-operation.h b/src/qmi-firmware-update/qfu-operation.h index 0edb373..2659051 100644 --- a/src/qmi-firmware-update/qfu-operation.h +++ b/src/qmi-firmware-update/qfu-operation.h @@ -35,6 +35,7 @@ gboolean qfu_operation_update_run (const gchar **images, gboolean device_open_proxy, gboolean device_open_mbim, gboolean ignore_version_errors, + gboolean override_download, gboolean skip_validation); gboolean qfu_operation_update_qdl_run (const gchar **images, QfuDeviceSelection *device_selection); diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c index 5800f80..3e9369f 100644 --- a/src/qmi-firmware-update/qfu-updater.c +++ b/src/qmi-firmware-update/qfu-updater.c @@ -55,6 +55,7 @@ struct _QfuUpdaterPrivate { gboolean device_open_proxy; gboolean device_open_mbim; gboolean ignore_version_errors; + gboolean override_download; gboolean skip_validation; }; @@ -813,7 +814,8 @@ set_firmware_preference_ready (QmiClientDms *client, if (qmi_message_dms_set_firmware_preference_output_get_image_download_list (output, &array, &error)) { if (!array->len) { g_print ("device already contains the given firmware/config version: no download needed\n"); - g_print ("will power cycle to apply the new firmware preference...\n"); + g_print ("forcing the download may be requested with the --override-download option\n"); + g_print ("now power cycling to apply the new firmware preference...\n"); g_list_free_full (ctx->pending_images, (GDestroyNotify) g_object_unref); ctx->pending_images = NULL; } else { @@ -891,11 +893,16 @@ run_context_step_set_firmware_preference (GTask *task) qmi_message_dms_set_firmware_preference_input_set_list (input, array, NULL); g_array_unref (array); + if (self->priv->override_download) + qmi_message_dms_set_firmware_preference_input_set_download_override (input, TRUE, NULL); + g_debug ("[qfu-updater] setting firmware preference..."); g_debug ("[qfu-updater] modem image: unique id '%.16s', build id '%s'", (gchar *) (modem_image_id.unique_id->data), modem_image_id.build_id); g_debug ("[qfu-updater] pri image: unique id '%.16s', build id '%s'", (gchar *) (pri_image_id.unique_id->data), pri_image_id.build_id); + g_debug ("[qfu-updater] override download: %s", + self->priv->override_download ? "yes" : "no"); qmi_client_dms_set_firmware_preference (ctx->qmi_client, input, @@ -1281,6 +1288,7 @@ qfu_updater_new (QfuDeviceSelection *device_selection, gboolean device_open_proxy, gboolean device_open_mbim, gboolean ignore_version_errors, + gboolean override_download, gboolean skip_validation) { QfuUpdater *self; @@ -1296,6 +1304,7 @@ qfu_updater_new (QfuDeviceSelection *device_selection, self->priv->config_version = (config_version ? g_strdup (config_version) : NULL); self->priv->carrier = (carrier ? g_strdup (carrier) : NULL); self->priv->ignore_version_errors = ignore_version_errors; + self->priv->override_download = override_download; self->priv->skip_validation = skip_validation; return self; diff --git a/src/qmi-firmware-update/qfu-updater.h b/src/qmi-firmware-update/qfu-updater.h index 05b0631..f8c98bf 100644 --- a/src/qmi-firmware-update/qfu-updater.h +++ b/src/qmi-firmware-update/qfu-updater.h @@ -57,6 +57,7 @@ QfuUpdater *qfu_updater_new (QfuDeviceSelection *device_selection, gboolean device_open_proxy, gboolean device_open_mbim, gboolean ignore_version_errors, + gboolean override_download, gboolean skip_validation); QfuUpdater *qfu_updater_new_qdl (QfuDeviceSelection *device_selection); void qfu_updater_run (QfuUpdater *self, |