aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-3gpp.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2022-09-13 09:13:12 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2022-11-04 13:12:57 +0000
commit3bf15120f42bd66a27602bb02f8e4eb69e098a25 (patch)
tree174991140e27ef9cd625489f99a9042965508c29 /src/mm-iface-modem-3gpp.c
parent58f4eefea1af8e678e5d36100a28fc09ecf6f828 (diff)
iface-modem-3gpp: improve logging of user request to disable facility locks
Diffstat (limited to 'src/mm-iface-modem-3gpp.c')
-rw-r--r--src/mm-iface-modem-3gpp.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index fff3fef1..516e0156 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -1286,6 +1286,7 @@ typedef struct {
MMIfaceModem3gpp *self;
GVariant *dictionary;
MMModem3gppFacility facility;
+ gchar *facility_str;
guint8 slot;
gchar *control_key;
} HandleDisableFacilityLockContext;
@@ -1298,7 +1299,8 @@ handle_disable_facility_lock_context_free (HandleDisableFacilityLockContext *ctx
g_object_unref (ctx->self);
g_variant_unref (ctx->dictionary);
g_free (ctx->control_key);
- g_free (ctx);
+ g_free (ctx->facility_str);
+ g_slice_free (HandleDisableFacilityLockContext, ctx);
}
static void
@@ -1306,7 +1308,7 @@ update_lock_info_ready (MMIfaceModem *modem,
GAsyncResult *res,
HandleDisableFacilityLockContext *ctx)
{
- GError *error = NULL;
+ GError *error = NULL;
mm_iface_modem_update_lock_info_finish (modem, res, &error);
if (error) {
@@ -1328,11 +1330,15 @@ handle_disable_facility_lock_ready (MMIfaceModem3gpp *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish (self, res, &error)) {
+ mm_obj_warn (self, "failed disabling facility lock '%s': %s",
+ ctx->facility_str, error->message);
g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_disable_facility_lock_context_free (ctx);
return;
}
+ mm_obj_info (self, "facility lock '%s' disabled", ctx->facility_str);
+
/* Update the Enabled Facility Locks property in the DBus interface */
facilities = mm_gdbus_modem3gpp_get_enabled_facility_locks (ctx->skeleton);
facilities &= ~ctx->facility;
@@ -1361,20 +1367,16 @@ disable_facility_lock_auth_ready (MMBaseModem *self,
/* If disable facility locks is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot disable facility locks: operation not supported");
+ g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_disable_facility_lock_context_free (ctx);
return;
}
/* Parse properties dictionary */
if (!g_variant_is_of_type (ctx->dictionary, G_VARIANT_TYPE ("(us)"))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot disable facility locks: invalid parameters");
+ g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Invalid parameters");
handle_disable_facility_lock_context_free (ctx);
return;
}
@@ -1394,14 +1396,15 @@ disable_facility_lock_auth_ready (MMBaseModem *self,
MM_MODEM_3GPP_FACILITY_NET_SUB_PERS |
MM_MODEM_3GPP_FACILITY_PROVIDER_PERS |
MM_MODEM_3GPP_FACILITY_CORP_PERS))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
+ g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"Invalid type of facility lock to disable or empty key");
handle_disable_facility_lock_context_free (ctx);
return;
}
+ ctx->facility_str = mm_modem_3gpp_facility_build_string_from_mask (ctx->facility);
+ mm_obj_info (self, "processing user request to disable facility lock '%s'...", ctx->facility_str);
+ mm_obj_info (self, " control key: %s", mm_log_str_personal_info (ctx->control_key));
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock (
MM_IFACE_MODEM_3GPP (self),
ctx->facility,
@@ -1419,7 +1422,7 @@ handle_disable_facility_lock (MmGdbusModem3gpp *skeleton,
{
HandleDisableFacilityLockContext *ctx;
- ctx = g_new0 (HandleDisableFacilityLockContext, 1);
+ ctx = g_slice_new0 (HandleDisableFacilityLockContext);
ctx->skeleton = g_object_ref (skeleton);
ctx->invocation = g_object_ref (invocation);
ctx->self = g_object_ref (self);