aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-02-18 12:16:54 -0600
committerDan Williams <dcbw@redhat.com>2014-06-13 11:30:49 -0500
commit6e5d013eb12d6ee134a59d4131128374af139fb3 (patch)
tree574814c5621141fa016159f62728b5678fdd5e80
parenta416d8056c9f9bbc8b926ffbe8f066859054a990 (diff)
broadband-bearer-sierra: use Icera authentication for Icera devices
Devices with Icera chipsets (USB305) don't support the Qualcomm proprietary $QCPDPP command, and we must use the Icera command instead. Otherwise authenticated bearer creation will fail.
-rw-r--r--plugins/sierra/mm-broadband-bearer-sierra.c90
-rw-r--r--plugins/sierra/mm-broadband-bearer-sierra.h3
-rw-r--r--plugins/sierra/mm-broadband-modem-sierra-icera.c1
-rw-r--r--plugins/sierra/mm-broadband-modem-sierra.c1
4 files changed, 89 insertions, 6 deletions
diff --git a/plugins/sierra/mm-broadband-bearer-sierra.c b/plugins/sierra/mm-broadband-bearer-sierra.c
index dbe8a448..b4bfe109 100644
--- a/plugins/sierra/mm-broadband-bearer-sierra.c
+++ b/plugins/sierra/mm-broadband-bearer-sierra.c
@@ -34,6 +34,16 @@
G_DEFINE_TYPE (MMBroadbandBearerSierra, mm_broadband_bearer_sierra, MM_TYPE_BROADBAND_BEARER);
+struct _MMBroadbandBearerSierraPrivate {
+ gboolean is_icera;
+};
+
+enum {
+ PROP_0,
+ PROP_IS_ICERA,
+ PROP_LAST
+};
+
/*****************************************************************************/
/* 3GPP Dialing (sub-step of the 3GPP Connection sequence) */
@@ -198,7 +208,10 @@ dial_3gpp_context_step (Dial3gppContext *ctx)
if (!user || !password || allowed_auth == MM_BEARER_ALLOWED_AUTH_NONE) {
mm_dbg ("Not using authentication");
- command = g_strdup_printf ("$QCPDPP=%d,0", ctx->cid);
+ if (ctx->self->priv->is_icera)
+ command = g_strdup_printf ("%%IPDPCFG=%d,0,0,\"\",\"\"", ctx->cid);
+ else
+ command = g_strdup_printf ("$QCPDPP=%d,0", ctx->cid);
} else {
gchar *quoted_user;
gchar *quoted_password;
@@ -230,11 +243,20 @@ dial_3gpp_context_step (Dial3gppContext *ctx)
quoted_user = mm_port_serial_at_quote_string (user);
quoted_password = mm_port_serial_at_quote_string (password);
- command = g_strdup_printf ("$QCPDPP=%d,%u,%s,%s",
- ctx->cid,
- sierra_auth,
- quoted_password,
- quoted_user);
+ if (ctx->self->priv->is_icera) {
+ command = g_strdup_printf ("%%IPDPCFG=%d,0,%u,%s,%s",
+ ctx->cid,
+ sierra_auth,
+ quoted_user,
+ quoted_password);
+ } else {
+ /* Yes, password comes first... */
+ command = g_strdup_printf ("$QCPDPP=%d,%u,%s,%s",
+ ctx->cid,
+ sierra_auth,
+ quoted_password,
+ quoted_user);
+ }
g_free (quoted_user);
g_free (quoted_password);
}
@@ -421,6 +443,8 @@ disconnect_3gpp (MMBroadbandBearer *self,
/*****************************************************************************/
+#define MM_BROADBAND_BEARER_SIERRA_IS_ICERA "is-icera"
+
MMBearer *
mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
GError **error)
@@ -444,6 +468,7 @@ mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
void
mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
MMBearerProperties *config,
+ gboolean is_icera,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -456,21 +481,74 @@ mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
user_data,
MM_BEARER_MODEM, modem,
MM_BEARER_CONFIG, config,
+ MM_BROADBAND_BEARER_SIERRA_IS_ICERA, is_icera,
NULL);
}
static void
+set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ MMBroadbandBearerSierra *self = MM_BROADBAND_BEARER_SIERRA (object);
+
+ switch (prop_id) {
+ case PROP_IS_ICERA:
+ self->priv->is_icera = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ MMBroadbandBearerSierra *self = MM_BROADBAND_BEARER_SIERRA (object);
+
+ switch (prop_id) {
+ case PROP_IS_ICERA:
+ g_value_set_boolean (value, self->priv->is_icera);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
mm_broadband_bearer_sierra_init (MMBroadbandBearerSierra *self)
{
+ /* Initialize private data */
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
+ MM_TYPE_BROADBAND_BEARER_SIERRA,
+ MMBroadbandBearerSierraPrivate);
}
static void
mm_broadband_bearer_sierra_class_init (MMBroadbandBearerSierraClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
MMBroadbandBearerClass *broadband_bearer_class = MM_BROADBAND_BEARER_CLASS (klass);
+ g_type_class_add_private (object_class, sizeof (MMBroadbandBearerSierraPrivate));
+
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
broadband_bearer_class->dial_3gpp = dial_3gpp;
broadband_bearer_class->dial_3gpp_finish = dial_3gpp_finish;
broadband_bearer_class->disconnect_3gpp = disconnect_3gpp;
broadband_bearer_class->disconnect_3gpp_finish = disconnect_3gpp_finish;
+
+ g_object_class_install_property (object_class, PROP_IS_ICERA,
+ g_param_spec_boolean (MM_BROADBAND_BEARER_SIERRA_IS_ICERA,
+ "IsIcera",
+ "Whether the modem uses Icera commands or not.",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
diff --git a/plugins/sierra/mm-broadband-bearer-sierra.h b/plugins/sierra/mm-broadband-bearer-sierra.h
index 98b0735c..fea7b94f 100644
--- a/plugins/sierra/mm-broadband-bearer-sierra.h
+++ b/plugins/sierra/mm-broadband-bearer-sierra.h
@@ -36,9 +36,11 @@
typedef struct _MMBroadbandBearerSierra MMBroadbandBearerSierra;
typedef struct _MMBroadbandBearerSierraClass MMBroadbandBearerSierraClass;
+typedef struct _MMBroadbandBearerSierraPrivate MMBroadbandBearerSierraPrivate;
struct _MMBroadbandBearerSierra {
MMBroadbandBearer parent;
+ MMBroadbandBearerSierraPrivate *priv;
};
struct _MMBroadbandBearerSierraClass {
@@ -50,6 +52,7 @@ GType mm_broadband_bearer_sierra_get_type (void);
/* Default 3GPP bearer creation implementation */
void mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
MMBearerProperties *config,
+ gboolean is_icera,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
diff --git a/plugins/sierra/mm-broadband-modem-sierra-icera.c b/plugins/sierra/mm-broadband-modem-sierra-icera.c
index e01ea0a0..3bfad984 100644
--- a/plugins/sierra/mm-broadband-modem-sierra-icera.c
+++ b/plugins/sierra/mm-broadband-modem-sierra-icera.c
@@ -87,6 +87,7 @@ modem_create_bearer (MMIfaceModem *self,
mm_dbg ("Creating Sierra bearer...");
mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self),
properties,
+ TRUE, /* is_icera */
NULL, /* cancellable */
(GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
result);
diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index e49c84cb..d6dd965b 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
+++ b/plugins/sierra/mm-broadband-modem-sierra.c
@@ -1136,6 +1136,7 @@ modem_create_bearer (MMIfaceModem *self,
mm_dbg ("Creating Sierra bearer...");
mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self),
properties,
+ FALSE, /* is_icera */
NULL, /* cancellable */
(GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
result);