aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmi-firmware-update
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-01-16 18:56:06 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-01-16 22:16:38 +0100
commitebeb8bb2b7c5e95a339c6b3f7c39ae49f171cdbb (patch)
treecaf0ac7a9d43bf5937f4963941730b4e6934e964 /src/qmi-firmware-update
parentd39f6975aedaa1befd07ea5d71249a8885f28dc6 (diff)
downloadexternal_libqmi-ebeb8bb2b7c5e95a339c6b3f7c39ae49f171cdbb.zip
external_libqmi-ebeb8bb2b7c5e95a339c6b3f7c39ae49f171cdbb.tar.gz
external_libqmi-ebeb8bb2b7c5e95a339c6b3f7c39ae49f171cdbb.tar.bz2
qmi-firmware-update: allow skipping new firmware validation
And increase amount of retries.
Diffstat (limited to 'src/qmi-firmware-update')
-rw-r--r--src/qmi-firmware-update/qfu-main.c8
-rw-r--r--src/qmi-firmware-update/qfu-operation-update.c6
-rw-r--r--src/qmi-firmware-update/qfu-operation.h3
-rw-r--r--src/qmi-firmware-update/qfu-reseter.c1
-rw-r--r--src/qmi-firmware-update/qfu-updater.c27
-rw-r--r--src/qmi-firmware-update/qfu-updater.h3
-rw-r--r--src/qmi-firmware-update/qfu-utils.c5
-rw-r--r--src/qmi-firmware-update/qfu-utils.h1
8 files changed, 44 insertions, 10 deletions
diff --git a/src/qmi-firmware-update/qfu-main.c b/src/qmi-firmware-update/qfu-main.c
index 321a5d5..c0effd5 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 force_flag;
+static gboolean skip_validation_flag;
/* Reset */
static gboolean action_reset_flag;
@@ -219,6 +220,10 @@ static GOptionEntry context_update_entries[] = {
"Force update operation even with version string errors.",
NULL
},
+ { "skip-validation", 0, 0, G_OPTION_ARG_NONE, &skip_validation_flag,
+ "Don't wait to validate the running firmware after update.",
+ NULL
+ },
{ NULL }
};
@@ -551,7 +556,8 @@ int main (int argc, char **argv)
carrier_str,
device_open_proxy_flag,
device_open_mbim_flag,
- force_flag);
+ force_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 708e0a0..317b14e 100644
--- a/src/qmi-firmware-update/qfu-operation-update.c
+++ b/src/qmi-firmware-update/qfu-operation-update.c
@@ -123,7 +123,8 @@ qfu_operation_update_run (const gchar **images,
const gchar *carrier,
gboolean device_open_proxy,
gboolean device_open_mbim,
- gboolean force)
+ gboolean force,
+ gboolean skip_validation)
{
QfuUpdater *updater = NULL;
gboolean result;
@@ -136,7 +137,8 @@ qfu_operation_update_run (const gchar **images,
carrier,
device_open_proxy,
device_open_mbim,
- force);
+ force,
+ skip_validation);
result = operation_update_run (updater, images);
g_object_unref (updater);
return result;
diff --git a/src/qmi-firmware-update/qfu-operation.h b/src/qmi-firmware-update/qfu-operation.h
index 683e6d5..a7bab9d 100644
--- a/src/qmi-firmware-update/qfu-operation.h
+++ b/src/qmi-firmware-update/qfu-operation.h
@@ -34,7 +34,8 @@ gboolean qfu_operation_update_run (const gchar **images,
const gchar *carrier,
gboolean device_open_proxy,
gboolean device_open_mbim,
- gboolean force);
+ gboolean force,
+ gboolean skip_validation);
gboolean qfu_operation_update_qdl_run (const gchar **images,
QfuDeviceSelection *device_selection);
gboolean qfu_operation_verify_run (const gchar **images);
diff --git a/src/qmi-firmware-update/qfu-reseter.c b/src/qmi-firmware-update/qfu-reseter.c
index 769ab8e..3b81d7c 100644
--- a/src/qmi-firmware-update/qfu-reseter.c
+++ b/src/qmi-firmware-update/qfu-reseter.c
@@ -386,6 +386,7 @@ qfu_reseter_run (QfuReseter *self,
/* Otherwise, try to allocate a QMI client */
g_assert (ctx->cdc_wdm);
qfu_utils_new_client_dms (ctx->cdc_wdm,
+ 3,
self->priv->device_open_proxy,
self->priv->device_open_mbim,
FALSE,
diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c
index 21b4559..ca7eb6d 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 force;
+ gboolean skip_validation;
};
/******************************************************************************/
@@ -77,7 +78,7 @@ static const gchar *progress[] = {
/* Wait time after the upgrade has been done, before using the cdc-wdm port */
#define WAIT_FOR_BOOT_TIMEOUT_SECS 5
-#define WAIT_FOR_BOOT_RETRIES 6
+#define WAIT_FOR_BOOT_RETRIES 12
typedef enum {
RUN_CONTEXT_STEP_QMI_CLIENT,
@@ -253,6 +254,7 @@ run_context_step_qmi_client_after (GTask *task)
g_debug ("[qfu-updater] creating QMI DMS client after upgrade...");
g_assert (ctx->cdc_wdm_file);
qfu_utils_new_client_dms (ctx->cdc_wdm_file,
+ 1, /* single try to allocate DMS client */
self->priv->device_open_proxy,
self->priv->device_open_mbim,
TRUE,
@@ -311,9 +313,11 @@ wait_for_cdc_wdm_ready (QfuDeviceSelection *device_selection,
{
GError *error = NULL;
RunContext *ctx;
+ QfuUpdater *self;
gchar *path;
ctx = (RunContext *) g_task_get_task_data (task);
+ self = g_task_get_source_object (task);
g_assert (!ctx->cdc_wdm_file);
ctx->cdc_wdm_file = qfu_device_selection_wait_for_cdc_wdm_finish (device_selection, res, &error);
@@ -330,6 +334,22 @@ wait_for_cdc_wdm_ready (QfuDeviceSelection *device_selection,
g_print ("normal mode detected\n");
+ /* If no need to validate, we're done */
+ if (self->priv->skip_validation) {
+ run_context_step_next (task, RUN_CONTEXT_STEP_LAST);
+ return;
+ }
+
+ g_print ("\n"
+ "--------------------------------------------------\n"
+ " Note:\n"
+ " In order to validate which is the firmware running in the module,\n"
+ " the program will wait for a complete boot.\n"
+ "\n"
+ " This process may take some time and several retries.\n"
+ "--------------------------------------------------\n"
+ "\n");
+
/* Go on */
run_context_step_next (task, ctx->step + 1);
}
@@ -1031,6 +1051,7 @@ run_context_step_qmi_client (GTask *task)
g_debug ("[qfu-updater] creating QMI DMS client...");
g_assert (ctx->cdc_wdm_file);
qfu_utils_new_client_dms (ctx->cdc_wdm_file,
+ 3, /* initially, up to 3 tries to allocate DMS client */
self->priv->device_open_proxy,
self->priv->device_open_mbim,
TRUE,
@@ -1207,7 +1228,8 @@ qfu_updater_new (QfuDeviceSelection *device_selection,
const gchar *carrier,
gboolean device_open_proxy,
gboolean device_open_mbim,
- gboolean force)
+ gboolean force,
+ gboolean skip_validation)
{
QfuUpdater *self;
@@ -1222,6 +1244,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->force = force;
+ 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 8aa1a00..90eb57b 100644
--- a/src/qmi-firmware-update/qfu-updater.h
+++ b/src/qmi-firmware-update/qfu-updater.h
@@ -56,7 +56,8 @@ QfuUpdater *qfu_updater_new (QfuDeviceSelection *device_selection,
const gchar *carrier,
gboolean device_open_proxy,
gboolean device_open_mbim,
- gboolean force);
+ gboolean force,
+ gboolean skip_validation);
QfuUpdater *qfu_updater_new_qdl (QfuDeviceSelection *device_selection);
void qfu_updater_run (QfuUpdater *self,
GList *image_file_list,
diff --git a/src/qmi-firmware-update/qfu-utils.c b/src/qmi-firmware-update/qfu-utils.c
index f4b5707..8a55f13 100644
--- a/src/qmi-firmware-update/qfu-utils.c
+++ b/src/qmi-firmware-update/qfu-utils.c
@@ -216,8 +216,6 @@ out:
/******************************************************************************/
-#define QMI_CLIENT_RETRIES 3
-
typedef struct {
QmiDevice *qmi_device;
gboolean device_open_proxy;
@@ -515,6 +513,7 @@ qmi_device_ready (GObject *source,
void
qfu_utils_new_client_dms (GFile *cdc_wdm_file,
+ guint retries,
gboolean device_open_proxy,
gboolean device_open_mbim,
gboolean load_capabilities,
@@ -526,10 +525,10 @@ qfu_utils_new_client_dms (GFile *cdc_wdm_file,
NewClientDmsContext *ctx;
ctx = g_slice_new0 (NewClientDmsContext);
+ ctx->qmi_client_retries = retries;
ctx->device_open_proxy = device_open_proxy;
ctx->device_open_mbim = device_open_mbim;
ctx->load_capabilities = load_capabilities;
- ctx->qmi_client_retries = QMI_CLIENT_RETRIES;
task = g_task_new (NULL, cancellable, callback, user_data);
g_task_set_task_data (task, ctx, (GDestroyNotify) new_client_dms_context_free);
diff --git a/src/qmi-firmware-update/qfu-utils.h b/src/qmi-firmware-update/qfu-utils.h
index 45dbb39..e3e5d0c 100644
--- a/src/qmi-firmware-update/qfu-utils.h
+++ b/src/qmi-firmware-update/qfu-utils.h
@@ -45,6 +45,7 @@ gboolean qfu_utils_parse_cwe_version_string (const gchar *version,
GError **error);
void qfu_utils_new_client_dms (GFile *cdc_wdm_file,
+ guint retries,
gboolean device_open_proxy,
gboolean device_open_mbim,
gboolean load_capabilities,