diff --git a/cli/mmcli-completion b/cli/mmcli-completion
index c77b9fe3..33398949 100644
--- a/cli/mmcli-completion
+++ b/cli/mmcli-completion
@@ -70,6 +70,10 @@ _mmcli()
COMPREPLY=( $(compgen -W "[response]" -- $cur) )
return 0
;;
+ '--3gpp-disable-facility-lock')
+ COMPREPLY=( $(compgen -W "[FACILITY,CONTROL_KEY]" -- $cur) )
+ return 0
+ ;;
'--cdma-activate')
COMPREPLY=( $(compgen -W "[CARRIER]" -- $cur) )
return 0
diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c
index d498eb62..8ea82efd 100644
--- a/cli/mmcli-modem-3gpp.c
+++ b/cli/mmcli-modem-3gpp.c
@@ -51,6 +51,7 @@ static gboolean register_home_flag;
static gchar *register_in_operator_str;
static gchar *set_eps_ue_mode_operation_str;
static gchar *set_initial_eps_bearer_settings_str;
+static gchar *disable_facility_lock_str;
static GOptionEntry entries[] = {
{ "3gpp-scan", 0, 0, G_OPTION_ARG_NONE, &scan_flag,
@@ -73,6 +74,10 @@ static GOptionEntry entries[] = {
"Set the initial EPS bearer settings",
"[\"key=value,...\"]"
},
+ { "3gpp-disable-facility-lock", 0, 0, G_OPTION_ARG_STRING, &disable_facility_lock_str,
+ "Disable facility personalization",
+ "[facility,key]"
+ },
{ NULL }
};
@@ -104,7 +109,8 @@ mmcli_modem_3gpp_options_enabled (void)
register_home_flag +
!!register_in_operator_str +
!!set_eps_ue_mode_operation_str +
- !!set_initial_eps_bearer_settings_str);
+ !!set_initial_eps_bearer_settings_str +
+ !!disable_facility_lock_str);
if (n_actions > 1) {
g_printerr ("error: too many 3GPP actions requested\n");
@@ -138,13 +144,19 @@ context_free (void)
}
static void
-ensure_modem_3gpp (void)
+ensure_modem_enabled (void)
{
if (mm_modem_get_state (mm_object_peek_modem (ctx->object)) < MM_MODEM_STATE_ENABLED) {
g_printerr ("error: modem not enabled yet\n");
exit (EXIT_FAILURE);
}
+ /* Success */
+}
+
+static void
+ensure_modem_3gpp (void)
+{
if (!ctx->modem_3gpp) {
g_printerr ("error: modem has no 3GPP capabilities\n");
exit (EXIT_FAILURE);
@@ -279,6 +291,33 @@ parse_eps_ue_mode_operation (MMModem3gppEpsUeModeOperation *uemode)
}
}
+static void
+disable_facility_lock_process_reply (gboolean result,
+ const GError *error)
+{
+ if (!result) {
+ g_printerr ("error: couldn't disable facility lock: '%s'\n",
+ error ? error->message : "unknown error");
+ exit (EXIT_FAILURE);
+ }
+
+ g_print ("successfully disabled facility lock\n");
+}
+
+static void
+disable_facility_lock_ready (MMModem3gpp *modem_3gpp,
+ GAsyncResult *result,
+ gpointer nothing)
+{
+ gboolean operation_result;
+ GError *error = NULL;
+
+ operation_result = mm_modem_3gpp_disable_facility_lock_finish (modem_3gpp, result, &error);
+ disable_facility_lock_process_reply (operation_result, error);
+
+ mmcli_async_operation_done ();
+}
+
static void
get_modem_ready (GObject *source,
GAsyncResult *result)
@@ -292,6 +331,34 @@ get_modem_ready (GObject *source,
ensure_modem_3gpp ();
+ /* Request to disable facility lock */
+ if (disable_facility_lock_str) {
+ gchar **properties;
+ gchar *control_key;
+ MMModem3gppFacility facility;
+
+ properties = g_strsplit (disable_facility_lock_str, ",", -1);
+ if (!properties[0] || !(control_key = properties[1]) ||
+ !(facility = mm_common_get_3gpp_facility_from_string (properties[0], NULL))) {
+ g_printerr ("Error parsing properties string.\n");
+ g_free (properties[0]);
+ g_free (properties[1]);
+ exit (EXIT_FAILURE);
+ }
+
+ g_debug ("Disable facility lock...");
+ mm_modem_3gpp_disable_facility_lock (ctx->modem_3gpp,
+ facility,
+ control_key,
+ ctx->cancellable,
+ (GAsyncReadyCallback)disable_facility_lock_ready,
+ NULL);
+ g_strfreev (properties);
+ return;
+ }
+
+ ensure_modem_enabled ();
+
/* Request to scan networks? */
if (scan_flag) {
g_debug ("Asynchronously scanning for networks...");
@@ -391,6 +458,35 @@ mmcli_modem_3gpp_run_synchronous (GDBusConnection *connection)
if (scan_flag)
g_assert_not_reached ();
+ /* Request to remove carrier lock */
+ if (disable_facility_lock_str) {
+ gchar **properties;
+ gchar *control_key;
+ MMModem3gppFacility facility;
+ gboolean result;
+
+ properties = g_strsplit (disable_facility_lock_str, ",", -1);
+ if (!properties[0] || !(control_key = properties[1]) ||
+ !(facility = mm_common_get_3gpp_facility_from_string (properties[0], NULL))) {
+ g_printerr ("Error parsing properties string.\n");
+ g_free (properties[0]);
+ g_free (properties[1]);
+ exit (EXIT_FAILURE);
+ }
+
+ g_debug ("Disable facility lock...");
+ result = mm_modem_3gpp_disable_facility_lock_sync (ctx->modem_3gpp,
+ facility,
+ control_key,
+ NULL,
+ &error);
+ g_strfreev (properties);
+ disable_facility_lock_process_reply (result, error);
+ return;
+ }
+
+ ensure_modem_enabled ();
+
/* Request to register the modem? */
if (register_in_operator_str || register_home_flag) {
gboolean result;
diff --git a/docs/man/mmcli.1 b/docs/man/mmcli.1
index 3e86931c..f2a75bb5 100644
--- a/docs/man/mmcli.1
+++ b/docs/man/mmcli.1
@@ -342,6 +342,23 @@ network-originated request. This option allows for that.
.TP
.B \-\-3gpp\-ussd\-cancel
Cancel an ongoing USSD session for a given modem.
+.TP
+.B \-\-3gpp\-disable\-facility\-lock=FACILITY,CONTROL_KEY
+Disable selected facility lock using provided control key.
+.RS 9
+.TP
+\fB'FACILITY'\fR
+One of the following types of lock:
+.Bd -literal -compact
+ \fB'net-pers'\fR - network personalization
+ \fB'net-sub-pers'\fR - network subset personalization
+ \fB'provider-pers'\fR - provider personalization
+ \fB'corp-pers'\fR - corporate personalization
+.Ed
+.TP
+\fB'CONTROL_KEY'\fR
+Alphanumeric code to unlock facility.
+.RE
.SH CDMA OPTIONS
All CDMA (Code Division Multiple Access) options require the
diff --git a/introspection/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml b/introspection/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml
index 3fba396d..4e7ca1c9 100644
--- a/introspection/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml
+++ b/introspection/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml
@@ -185,6 +185,33 @@
-->
+
+
+
+
+