diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 13:40:09 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 22:16:37 +0100 |
commit | df403e33947362aab97f88671987d8d0b190a891 (patch) | |
tree | 140269048e96d5c21fe0fe403f8eb2c051bcd19f /src/qmi-firmware-update | |
parent | b50239d2f53c5f00bddf51ca820efd11ca0bcfcb (diff) | |
download | external_libqmi-df403e33947362aab97f88671987d8d0b190a891.zip external_libqmi-df403e33947362aab97f88671987d8d0b190a891.tar.gz external_libqmi-df403e33947362aab97f88671987d8d0b190a891.tar.bz2 |
qmi-firmware-update: retry reloading device info several times
The device may need some extra time to properly boot after the cdc-wdm
device is exposed by the kernel, so setup several retries to do so.
Diffstat (limited to 'src/qmi-firmware-update')
-rw-r--r-- | src/qmi-firmware-update/qfu-updater.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c index 267c4ee..7ccd844 100644 --- a/src/qmi-firmware-update/qfu-updater.c +++ b/src/qmi-firmware-update/qfu-updater.c @@ -76,7 +76,8 @@ static const gchar *progress[] = { /* Run */ /* Wait time after the upgrade has been done, before using the cdc-wdm port */ -#define WAIT_FOR_BOOT_TIMEOUT_SECS 10 +#define WAIT_FOR_BOOT_TIMEOUT_SECS 5 +#define WAIT_FOR_BOOT_RETRIES 6 typedef enum { RUN_CONTEXT_STEP_QMI_CLIENT, @@ -135,6 +136,7 @@ typedef struct { /* Waiting for boot */ guint wait_for_boot_seconds_elapsed; + guint wait_for_boot_retries; } RunContext; static void @@ -221,9 +223,16 @@ new_client_dms_after_ready (gpointer unused, &ctx->new_supports_stored_image_management, &ctx->new_supports_firmware_preference_management, &error)) { - g_warning ("couldn't create DMS client after upgrade: %s", error->message); + if (ctx->wait_for_boot_retries == WAIT_FOR_BOOT_RETRIES) { + g_warning ("couldn't create DMS client after upgrade: %s", error->message); + run_context_step_next (task, ctx->step + 1); + } else { + g_debug ("couldn't create DMS client after upgrade: %s (will retry)", error->message); + run_context_step_next (task, RUN_CONTEXT_STEP_WAIT_FOR_BOOT); + } g_error_free (error); - } + return; + } /* Go on */ run_context_step_next (task, ctx->step + 1); @@ -238,7 +247,9 @@ run_context_step_qmi_client_after (GTask *task) ctx = (RunContext *) g_task_get_task_data (task); self = g_task_get_source_object (task); - g_print ("loading device information after the update...\n"); + ctx->wait_for_boot_retries++; + g_print ("loading device information after the update (%u/%u)...\n", + ctx->wait_for_boot_retries, WAIT_FOR_BOOT_RETRIES); g_debug ("[qfu-updater] creating QMI DMS client after upgrade..."); g_assert (ctx->cdc_wdm_file); @@ -278,6 +289,11 @@ wait_for_boot_ready (GTask *task) static void run_context_step_wait_for_boot (GTask *task) { + RunContext *ctx; + + ctx = (RunContext *) g_task_get_task_data (task); + ctx->wait_for_boot_seconds_elapsed = 0; + g_debug ("[qfu-updater] waiting some time (%us) before accessing the cdc-wdm device...", WAIT_FOR_BOOT_TIMEOUT_SECS); |