aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-02-01 23:43:36 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-02-01 23:44:58 +0100
commitbfaf09a2fdff45b7740743b19d7a6c4db561999f (patch)
treef935c9910bef507b6df335688a1f43ddf950c090
parent4fa04c8e4c24ca448901169ecf7f9836eebb45ba (diff)
downloadexternal_libqmi-bfaf09a2fdff45b7740743b19d7a6c4db561999f.zip
external_libqmi-bfaf09a2fdff45b7740743b19d7a6c4db561999f.tar.gz
external_libqmi-bfaf09a2fdff45b7740743b19d7a6c4db561999f.tar.bz2
qmi-firmware-update: start wait sequence before QmiDevice close
[01 feb 2017, 23:14:53] [Debug] [qfu-updater] reset requested successfully... [01 feb 2017, 23:14:53] [Debug] [qfu-updater] cleaning up QMI device... [01 feb 2017, 23:14:53] [Debug] [/dev/cdc-wdm2] Releasing 'dms' client with flags 'none'... [01 feb 2017, 23:14:53] [Debug] [/dev/cdc-wdm2] Unregistered 'dms' client with ID '2' [01 feb 2017, 23:14:53] [Debug] [/dev/cdc-wdm2] Sent message... <<<<<< RAW: <<<<<< length = 12 <<<<<< data = 02:00:00:00:0C:00:00:00:0B:00:00:00 [01 feb 2017, 23:14:53] [Debug] [/dev/cdc-wdm2] Sent message (translated)... <<<<<< Header: <<<<<< length = 12 <<<<<< type = close (0x00000002) <<<<<< transaction = 11 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove ttyUSB0 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove ttyUSB1 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove wwan0 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove 2-1.4:1.0 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove 2-1.4:1.3 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove cdc-wdm2 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove 2-1.4:1.13 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove 2-1.4:1.12 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: remove 2-1.4 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add 2-1.4 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add 2-1.4:1.0 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add 2-1.4:1.3 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add 2-1.4:1.12 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add 2-1.4:1.13 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add cdc-wdm2 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add ttyUSB0 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add wwan0 [01 feb 2017, 23:15:13] [Debug] [qfu-udev] event: add ttyUSB1 [01 feb 2017, 23:15:13] [Debug] [qfu-updater] now waiting for cdc-wdm device... error: error waiting for cdc-wdm: waiting for device at '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4' timed out
-rw-r--r--src/qmi-firmware-update/qfu-updater.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c
index 229b56d..10eb27c 100644
--- a/src/qmi-firmware-update/qfu-updater.c
+++ b/src/qmi-firmware-update/qfu-updater.c
@@ -343,6 +343,18 @@ run_context_step_next (GTask *task, RunContextStep next)
}
static void
+run_context_step_next_no_idle (GTask *task, RunContextStep next)
+{
+ RunContext *ctx;
+
+ ctx = (RunContext *) g_task_get_task_data (task);
+ ctx->step = next;
+
+ /* Run right away */
+ run_context_step (task);
+}
+
+static void
new_client_dms_after_ready (gpointer unused,
GAsyncResult *res,
GTask *task)
@@ -733,6 +745,7 @@ static void
run_context_step_cleanup_qmi_device (GTask *task)
{
RunContext *ctx;
+ QmiDevice *tmp;
ctx = (RunContext *) g_task_get_task_data (task);
@@ -745,19 +758,26 @@ run_context_step_cleanup_qmi_device (GTask *task)
10, NULL, NULL, NULL);
g_clear_object (&ctx->qmi_client);
- qmi_device_close (ctx->qmi_device, NULL);
- g_clear_object (&ctx->qmi_device);
+ /* We want to close and unref the QmiDevice only AFTER having set the wait
+ * tasks for cdc-wdm or tty devices. This is because the close operation may
+ * take a long time if doing QMI over MBIM (as the MBIM close async
+ * operation is run internally). If we don't do this in this sequence, we
+ * may end up getting udev events reported before the wait have started. */
+ tmp = g_object_ref (ctx->qmi_device);
+ g_clear_object (&ctx->qmi_device);
g_clear_object (&ctx->cdc_wdm_file);
/* If nothing to download we don't need to wait for QDL download mode */
- if (!ctx->pending_images) {
- run_context_step_next (task, RUN_CONTEXT_STEP_WAIT_FOR_CDC_WDM);
- return;
- }
-
- /* Go on */
- run_context_step_next (task, ctx->step + 1);
+ if (!ctx->pending_images)
+ run_context_step_next_no_idle (task, RUN_CONTEXT_STEP_WAIT_FOR_CDC_WDM);
+ else
+ /* Go on */
+ run_context_step_next_no_idle (task, ctx->step + 1);
+
+ /* After the wait operation has been started, we do run the close */
+ qmi_device_close (tmp, NULL);
+ g_object_unref (tmp);
}