aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/mmcli-completion4
-rw-r--r--cli/mmcli-modem-3gpp.c100
-rw-r--r--docs/man/mmcli.117
-rw-r--r--introspection/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml27
-rw-r--r--libmm-glib/mm-modem-3gpp.c50
-rw-r--r--libmm-glib/mm-modem-3gpp.h15
6 files changed, 211 insertions, 2 deletions
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);
@@ -280,6 +292,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
@@ -186,6 +186,33 @@
<property name="EnabledFacilityLocks" type="u" access="read" />
<!--
+ DisableFacilityLock:
+ @properties: A tuple of facility type and control key.
+
+ Sends control key to modem to disable selected facility lock
+
+ <variablelist>
+ <varlistentry><term>"facility"</term>
+ <listitem>
+ <para>
+ A <link linkend="MMModem3gppFacility">MMModem3gppFacility</link> value
+ representing the type of the facility lock to disable.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry><term>"control key"</term>
+ <listitem>
+ <para>
+ Alphanumeric key required to unlock facility.
+ </para>
+ </listitem>
+ </varlistentry>
+ -->
+ <method name="DisableFacilityLock">
+ <arg name="properties" type="(us)" direction="in" />
+ </method>
+
+ <!--
SubscriptionState:
A <link linkend="MMModem3gppSubscriptionState">MMModem3gppSubscriptionState</link>
diff --git a/libmm-glib/mm-modem-3gpp.c b/libmm-glib/mm-modem-3gpp.c
index 1cfb419d..a559ca2a 100644
--- a/libmm-glib/mm-modem-3gpp.c
+++ b/libmm-glib/mm-modem-3gpp.c
@@ -1260,6 +1260,56 @@ mm_modem_3gpp_set_initial_eps_bearer_settings_sync (MMModem3gpp *self,
/*****************************************************************************/
+void
+mm_modem_3gpp_disable_facility_lock (MMModem3gpp *self,
+ MMModem3gppFacility facility,
+ const gchar *control_key,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GVariant *properties;
+
+ properties = g_variant_ref_sink (g_variant_new ("(us)", (guint)facility, control_key));
+ mm_gdbus_modem3gpp_call_disable_facility_lock (MM_GDBUS_MODEM3GPP (self),
+ properties,
+ cancellable,
+ callback,
+ user_data);
+ g_variant_unref (properties);
+}
+
+gboolean
+mm_modem_3gpp_disable_facility_lock_finish (MMModem3gpp *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return mm_gdbus_modem3gpp_call_disable_facility_lock_finish (MM_GDBUS_MODEM3GPP (self),
+ res,
+ error);
+}
+
+gboolean
+mm_modem_3gpp_disable_facility_lock_sync (MMModem3gpp *self,
+ MMModem3gppFacility facility,
+ const gchar *control_key,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GVariant *properties;
+ gboolean result;
+
+ properties = g_variant_ref_sink (g_variant_new ("(us)", (guint)facility, control_key));
+ result = mm_gdbus_modem3gpp_call_disable_facility_lock_sync (MM_GDBUS_MODEM3GPP (self),
+ properties,
+ cancellable,
+ error);
+ g_variant_unref (properties);
+ return result;
+}
+
+/*****************************************************************************/
+
static void
mm_modem_3gpp_init (MMModem3gpp *self)
{
diff --git a/libmm-glib/mm-modem-3gpp.h b/libmm-glib/mm-modem-3gpp.h
index e3a506dc..8de6c756 100644
--- a/libmm-glib/mm-modem-3gpp.h
+++ b/libmm-glib/mm-modem-3gpp.h
@@ -172,6 +172,21 @@ gboolean mm_modem_3gpp_set_initial_eps_bearer_settings_sync (MMModem3gpp
GCancellable *cancellable,
GError **error);
+void mm_modem_3gpp_disable_facility_lock (MMModem3gpp *self,
+ MMModem3gppFacility facility,
+ const gchar *control_key,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_modem_3gpp_disable_facility_lock_finish (MMModem3gpp *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_modem_3gpp_disable_facility_lock_sync (MMModem3gpp *self,
+ MMModem3gppFacility facility,
+ const gchar *control_key,
+ GCancellable *cancellable,
+ GError **error);
+
#ifndef MM_DISABLE_DEPRECATED
G_DEPRECATED