summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Lobrano <c.lobrano@gmail.com>2022-07-14 10:34:57 +0200
committerAleksander Morgado <aleksander@aleksander.es>2022-07-22 11:01:33 +0200
commit6042bf1cdc9e526c458fcc348d2b92cf9a024037 (patch)
treebde9259c7e5dd2eed0b7982bc7b7d23439168fd7
parent14f1a7193b3cb2590a24f3eff47774d4ae0fc355 (diff)
mm-iface-modem-3gpp-profile-manager: do not try to deactivate unused profile
'mm_3gpp_profile_list_find_best' can return an unused profile ID, which is later tested for being already activated in 'profile_manager_check_activated_profile_ready' with +GCACT?. Since the profile does not exist, this check always fails, but the profile manager still tries to deactivate it, which is unnecessary. This change checks the return error from 'check_activated_profile' and skips SET_PROFILE_STEP_DEACTIVATE_PROFILE step if error is MM_CORE_ERROR_NOT_FOUND. (cherry picked from commit 85d4ad11580d52375675db81a4cb3799d43a89f8)
-rw-r--r--src/mm-iface-modem-3gpp-profile-manager.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mm-iface-modem-3gpp-profile-manager.c b/src/mm-iface-modem-3gpp-profile-manager.c
index ceeee522..0a14aac7 100644
--- a/src/mm-iface-modem-3gpp-profile-manager.c
+++ b/src/mm-iface-modem-3gpp-profile-manager.c
@@ -278,8 +278,13 @@ profile_manager_check_activated_profile_ready (MMIfaceModem3gppProfileManager *s
ctx = g_task_get_task_data (task);
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile_finish (self, res, &activated, &error)) {
- mm_obj_dbg (self, "couldn't check if profile '%d' is activated: %s", ctx->profile_id, error->message);
- ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE;
+ if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) {
+ mm_obj_dbg (self, "profile '%d' is not activated: %s", ctx->profile_id, error->message);
+ ctx->step = SET_PROFILE_STEP_STORE_PROFILE;
+ } else {
+ mm_obj_dbg (self, "couldn't check if profile '%d' is activated: %s", ctx->profile_id, error->message);
+ ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE;
+ }
}
else if (activated) {
mm_obj_dbg (self, "profile '%d' is activated", ctx->profile_id);