iface-modem-3gpp: improve logging of user request to disable facility locks
This commit is contained in:
@@ -1286,6 +1286,7 @@ typedef struct {
|
|||||||
MMIfaceModem3gpp *self;
|
MMIfaceModem3gpp *self;
|
||||||
GVariant *dictionary;
|
GVariant *dictionary;
|
||||||
MMModem3gppFacility facility;
|
MMModem3gppFacility facility;
|
||||||
|
gchar *facility_str;
|
||||||
guint8 slot;
|
guint8 slot;
|
||||||
gchar *control_key;
|
gchar *control_key;
|
||||||
} HandleDisableFacilityLockContext;
|
} HandleDisableFacilityLockContext;
|
||||||
@@ -1298,7 +1299,8 @@ handle_disable_facility_lock_context_free (HandleDisableFacilityLockContext *ctx
|
|||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
g_variant_unref (ctx->dictionary);
|
g_variant_unref (ctx->dictionary);
|
||||||
g_free (ctx->control_key);
|
g_free (ctx->control_key);
|
||||||
g_free (ctx);
|
g_free (ctx->facility_str);
|
||||||
|
g_slice_free (HandleDisableFacilityLockContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1306,7 +1308,7 @@ update_lock_info_ready (MMIfaceModem *modem,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
HandleDisableFacilityLockContext *ctx)
|
HandleDisableFacilityLockContext *ctx)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
mm_iface_modem_update_lock_info_finish (modem, res, &error);
|
mm_iface_modem_update_lock_info_finish (modem, res, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -1328,11 +1330,15 @@ handle_disable_facility_lock_ready (MMIfaceModem3gpp *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish (self, res, &error)) {
|
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);
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
handle_disable_facility_lock_context_free (ctx);
|
handle_disable_facility_lock_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm_obj_info (self, "facility lock '%s' disabled", ctx->facility_str);
|
||||||
|
|
||||||
/* Update the Enabled Facility Locks property in the DBus interface */
|
/* Update the Enabled Facility Locks property in the DBus interface */
|
||||||
facilities = mm_gdbus_modem3gpp_get_enabled_facility_locks (ctx->skeleton);
|
facilities = mm_gdbus_modem3gpp_get_enabled_facility_locks (ctx->skeleton);
|
||||||
facilities &= ~ctx->facility;
|
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 disable facility locks is not implemented, report an error */
|
||||||
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock ||
|
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock ||
|
||||||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish) {
|
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish) {
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||||
MM_CORE_ERROR,
|
"Operation not supported");
|
||||||
MM_CORE_ERROR_UNSUPPORTED,
|
|
||||||
"Cannot disable facility locks: operation not supported");
|
|
||||||
handle_disable_facility_lock_context_free (ctx);
|
handle_disable_facility_lock_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse properties dictionary */
|
/* Parse properties dictionary */
|
||||||
if (!g_variant_is_of_type (ctx->dictionary, G_VARIANT_TYPE ("(us)"))) {
|
if (!g_variant_is_of_type (ctx->dictionary, G_VARIANT_TYPE ("(us)"))) {
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||||
MM_CORE_ERROR,
|
"Invalid parameters");
|
||||||
MM_CORE_ERROR_UNSUPPORTED,
|
|
||||||
"Cannot disable facility locks: invalid parameters");
|
|
||||||
handle_disable_facility_lock_context_free (ctx);
|
handle_disable_facility_lock_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1394,14 +1396,15 @@ disable_facility_lock_auth_ready (MMBaseModem *self,
|
|||||||
MM_MODEM_3GPP_FACILITY_NET_SUB_PERS |
|
MM_MODEM_3GPP_FACILITY_NET_SUB_PERS |
|
||||||
MM_MODEM_3GPP_FACILITY_PROVIDER_PERS |
|
MM_MODEM_3GPP_FACILITY_PROVIDER_PERS |
|
||||||
MM_MODEM_3GPP_FACILITY_CORP_PERS))) {
|
MM_MODEM_3GPP_FACILITY_CORP_PERS))) {
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||||
MM_CORE_ERROR,
|
|
||||||
MM_CORE_ERROR_UNSUPPORTED,
|
|
||||||
"Invalid type of facility lock to disable or empty key");
|
"Invalid type of facility lock to disable or empty key");
|
||||||
handle_disable_facility_lock_context_free (ctx);
|
handle_disable_facility_lock_context_free (ctx);
|
||||||
return;
|
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_GET_INTERFACE (self)->disable_facility_lock (
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
MM_IFACE_MODEM_3GPP (self),
|
||||||
ctx->facility,
|
ctx->facility,
|
||||||
@@ -1419,7 +1422,7 @@ handle_disable_facility_lock (MmGdbusModem3gpp *skeleton,
|
|||||||
{
|
{
|
||||||
HandleDisableFacilityLockContext *ctx;
|
HandleDisableFacilityLockContext *ctx;
|
||||||
|
|
||||||
ctx = g_new0 (HandleDisableFacilityLockContext, 1);
|
ctx = g_slice_new0 (HandleDisableFacilityLockContext);
|
||||||
ctx->skeleton = g_object_ref (skeleton);
|
ctx->skeleton = g_object_ref (skeleton);
|
||||||
ctx->invocation = g_object_ref (invocation);
|
ctx->invocation = g_object_ref (invocation);
|
||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
|
Reference in New Issue
Block a user