From 9c1843c38153ff022491d1a5a663d527f4d8ebc2 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 29 Oct 2020 22:46:52 +0100 Subject: [PATCH] shared-qmi: ignore NoEffect errors on slot switching When "UIM Switch Slot" returns a NoEffect error it's because we're already in the desired slot, so just treat it as a successful operation. --- src/mm-shared-qmi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c index b0b061b2..d3ff0c22 100644 --- a/src/mm-shared-qmi.c +++ b/src/mm-shared-qmi.c @@ -3321,10 +3321,14 @@ next_sim_switch_ready (QmiClientUim *client, output = qmi_client_uim_switch_slot_finish (client, res, &error); if (!output || !qmi_message_uim_switch_slot_output_get_result (output, &error)) { - mm_obj_dbg (self, "couldn't switch to SIM at slot %u: won't load additional info", - ctx->current_slot_number); - load_next_sim_info (task); - return; + /* ignore NoEffect errors on slot switch, because that indicates we're + * already in the desired slot */ + if (!g_error_matches (error, QMI_PROTOCOL_ERROR, QMI_PROTOCOL_ERROR_NO_EFFECT)) { + mm_obj_dbg (self, "couldn't switch to SIM at slot %u: won't load additional info", + ctx->current_slot_number); + load_next_sim_info (task); + return; + } } mm_obj_dbg (self, "switched to SIM at slot %u: initializing...",