From 352b8ed53d69ef1ce4665c1dd76404451d3918a6 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 6 Mar 2025 08:29:56 -0600 Subject: broadband-modem-qmi: implement disabled 3GPP profiles Previously, a disabled profile would cause Profile Manager interface enabling to fail because get_profile_settings_ready() returned an error for disabled profiles. But 3GPP profile objects already have support for the enable/disabled setting, so just hook that up and stop returning an error for disabled ones. This allows successful initialization of the 3GPP Profile Manager on devices that contain disabled profiles. While we're at it, allow creating disabled profiles, and changing profiles back and forth from enabled<->disabled. Signed-off-by: Dan Williams --- src/mm-broadband-modem-qmi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 996f91e2..ee6310a9 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -6582,12 +6582,17 @@ wds_profile_settings_to_3gpp_profile (MMBroadbandModemQmi *se QmiWdsPdpType pdp_type; QmiWdsAuthentication auth; QmiWdsApnTypeMask apn_type; + gboolean profile_disabled; profile = mm_3gpp_profile_new (); /* On 3GPP modems, the modem seems to force profile-index = pdp-context-number, * and so, we're just going to rely on the profile-index ourselves.*/ mm_3gpp_profile_set_profile_id (profile, (gint) profile_index); + mm_3gpp_profile_set_enabled (profile, TRUE); + + if (qmi_message_wds_get_profile_settings_output_get_apn_disabled_flag (output, &profile_disabled, NULL)) + mm_3gpp_profile_set_enabled (profile, !profile_disabled); if (qmi_message_wds_get_profile_settings_output_get_apn_name (output, &str, NULL)) mm_3gpp_profile_set_apn (profile, str); @@ -6627,7 +6632,6 @@ get_profile_settings_ready (QmiClientWds *client, MMBroadbandModemQmi *self; GError *error = NULL; gint profile_id; - gboolean profile_disabled = FALSE; MM3gppProfile *profile; g_autoptr(QmiMessageWdsGetProfileSettingsOutput) output = NULL; @@ -6642,15 +6646,6 @@ get_profile_settings_ready (QmiClientWds *client, return; } - /* just ignore the profile if it's disabled */ - qmi_message_wds_get_profile_settings_output_get_apn_disabled_flag (output, &profile_disabled, NULL); - if (profile_disabled) { - g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, - "Profile '%d' is internally disabled", profile_id); - g_object_unref (task); - return; - } - profile = wds_profile_settings_to_3gpp_profile (self, profile_id, output, &error); if (!profile) g_task_return_error (task, error); @@ -6850,6 +6845,7 @@ typedef struct { QmiWdsApnTypeMask qmi_apn_type; QmiWdsAuthentication qmi_auth; QmiWdsPdpType qmi_pdp_type; + gboolean apn_disabled_flag; } StoreProfileContext; static void @@ -6990,6 +6986,7 @@ store_profile_run (GTask *task) qmi_message_wds_create_profile_input_set_authentication (input, ctx->qmi_auth, NULL); qmi_message_wds_create_profile_input_set_username (input, ctx->user, NULL); qmi_message_wds_create_profile_input_set_password (input, ctx->password, NULL); + qmi_message_wds_create_profile_input_set_apn_disabled_flag (input, ctx->apn_disabled_flag, NULL); if (!self->priv->apn_type_not_supported) qmi_message_wds_create_profile_input_set_apn_type_mask (input, ctx->qmi_apn_type, NULL); @@ -7010,6 +7007,7 @@ store_profile_run (GTask *task) qmi_message_wds_modify_profile_input_set_authentication (input, ctx->qmi_auth, NULL); qmi_message_wds_modify_profile_input_set_username (input, ctx->user, NULL); qmi_message_wds_modify_profile_input_set_password (input, ctx->password, NULL); + qmi_message_wds_modify_profile_input_set_apn_disabled_flag (input, ctx->apn_disabled_flag, NULL); if (!self->priv->apn_type_not_supported) qmi_message_wds_modify_profile_input_set_apn_type_mask (input, ctx->qmi_apn_type, NULL); @@ -7083,6 +7081,8 @@ modem_3gpp_profile_manager_store_profile (MMIfaceModem3gppProfileManager *self, return; } + ctx->apn_disabled_flag = !mm_3gpp_profile_get_enabled (profile); + store_profile_run (task); } -- cgit v1.2.3-70-g09d2