From 9c353cf6f0a7650cfe1b914d6881890de9dff0b0 Mon Sep 17 00:00:00 2001 From: Louis-Alexis Eyraud Date: Fri, 15 Jan 2021 15:14:58 +0100 Subject: [PATCH] zte: add 1 second delay after sim unlock to avoid IMSI reading issue Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/306 Signed-off-by: Louis-Alexis Eyraud --- plugins/zte/mm-broadband-modem-zte.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/plugins/zte/mm-broadband-modem-zte.c b/plugins/zte/mm-broadband-modem-zte.c index 64549cd8..08bbed83 100644 --- a/plugins/zte/mm-broadband-modem-zte.c +++ b/plugins/zte/mm-broadband-modem-zte.c @@ -187,6 +187,19 @@ modem_after_sim_unlock_context_step (GTask *task) task); } +static gboolean +after_sim_unlock_wait_cb (GTask *task) +{ + /* Attempt to disable floods of "+ZUSIMR:2" unsolicited responses that + * eventually fill up the device's buffers and make it crash. Normally + * done during probing, but if the device has a PIN enabled it won't + * accept the +CPMS? during the probe and we have to do it here. + */ + modem_after_sim_unlock_context_step (task); + + return G_SOURCE_REMOVE; +} + static void modem_after_sim_unlock (MMIfaceModem *self, GAsyncReadyCallback callback, @@ -201,12 +214,7 @@ modem_after_sim_unlock (MMIfaceModem *self, task = g_task_new (self, NULL, callback, user_data); g_task_set_task_data (task, ctx, g_free); - /* Attempt to disable floods of "+ZUSIMR:2" unsolicited responses that - * eventually fill up the device's buffers and make it crash. Normally - * done during probing, but if the device has a PIN enabled it won't - * accept the +CPMS? during the probe and we have to do it here. - */ - modem_after_sim_unlock_context_step (task); + g_timeout_add_seconds (1, (GSourceFunc)after_sim_unlock_wait_cb, task); } /*****************************************************************************/