REVERT-ME: sim-qmi: Delay sim loading by 1 second
If two sims are inserted, the FW reports IMSI of both sims to be the
same. Currently, MM uses a successful GET_CARD_STATUS as an
indication that the sim is ready. It then reads stale IMSI from the
firmware.
A workaround is to wait 1 second after GET_CARD_STATUS before reading
IMSI. For the ideal fix, we need a method to know when the new SIM's
IMEI has been read by the FW.
This bug does not affect us when a single sim is inserted.
BUG=b:182484170
TEST=restart modemmanager; modem status
Change-Id: I7616c2b70c038e72137ae679d327997562cc046d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/modemmanager-next/+/2753029
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Tested-by: Pavan Holla <pholla@google.com>
Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
diff --git a/src/mm-sim-qmi.c b/src/mm-sim-qmi.c
index 4d8ad04..5394666 100644
--- a/src/mm-sim-qmi.c
+++ b/src/mm-sim-qmi.c
@@ -131,6 +131,21 @@
g_timeout_add_seconds (SIM_READY_CHECKS_TIMEOUT_SECS, (GSourceFunc) sim_ready_retry_cb, task);
}
+static gboolean
+sim_ready_cb (GTask *task)
+{
+ MMSimQmi *self;
+
+ self = g_task_get_source_object (task);
+ /* SIM is considered ready now */
+ mm_obj_dbg (self, "sim is ready");
+ g_task_return_boolean (task, TRUE);
+ g_object_unref (task);
+ return G_SOURCE_REMOVE;
+}
+
+# define FW_SIM_DELAY_MSECS 1000
+
static void
uim_get_card_status_ready (QmiClientUim *client,
GAsyncResult *res,
@@ -153,10 +168,11 @@
return;
}
- /* SIM is considered ready now */
- mm_obj_dbg (self, "sim is ready");
- g_task_return_boolean (task, TRUE);
- g_object_unref (task);
+ /* This is a hack to ungate esim development on chromeos until QC fixes the FW. b/182484170
+ * In multi-sim scenarios, the firmware might need extra time to
+ * clear stale imsi and home network information from the previous slot.
+ * This delay makes the firmware respond correctly to "Read Trasparent" and "Get Home Network" */
+ g_timeout_add (FW_SIM_DELAY_MSECS, (GSourceFunc) sim_ready_cb, task);
}
static void