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.
This commit is contained in:
@@ -34,6 +34,16 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (MMBroadbandBearerSierra, mm_broadband_bearer_sierra, MM_TYPE_BROADBAND_BEARER);
|
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) */
|
/* 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) {
|
if (!user || !password || allowed_auth == MM_BEARER_ALLOWED_AUTH_NONE) {
|
||||||
mm_dbg ("Not using authentication");
|
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 {
|
} else {
|
||||||
gchar *quoted_user;
|
gchar *quoted_user;
|
||||||
gchar *quoted_password;
|
gchar *quoted_password;
|
||||||
@@ -230,11 +243,20 @@ dial_3gpp_context_step (Dial3gppContext *ctx)
|
|||||||
|
|
||||||
quoted_user = mm_port_serial_at_quote_string (user);
|
quoted_user = mm_port_serial_at_quote_string (user);
|
||||||
quoted_password = mm_port_serial_at_quote_string (password);
|
quoted_password = mm_port_serial_at_quote_string (password);
|
||||||
command = g_strdup_printf ("$QCPDPP=%d,%u,%s,%s",
|
if (ctx->self->priv->is_icera) {
|
||||||
ctx->cid,
|
command = g_strdup_printf ("%%IPDPCFG=%d,0,%u,%s,%s",
|
||||||
sierra_auth,
|
ctx->cid,
|
||||||
quoted_password,
|
sierra_auth,
|
||||||
quoted_user);
|
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_user);
|
||||||
g_free (quoted_password);
|
g_free (quoted_password);
|
||||||
}
|
}
|
||||||
@@ -421,6 +443,8 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define MM_BROADBAND_BEARER_SIERRA_IS_ICERA "is-icera"
|
||||||
|
|
||||||
MMBearer *
|
MMBearer *
|
||||||
mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
|
mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
@@ -444,6 +468,7 @@ mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
|
|||||||
void
|
void
|
||||||
mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
|
mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
|
||||||
MMBearerProperties *config,
|
MMBearerProperties *config,
|
||||||
|
gboolean is_icera,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@@ -456,21 +481,74 @@ mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
|
|||||||
user_data,
|
user_data,
|
||||||
MM_BEARER_MODEM, modem,
|
MM_BEARER_MODEM, modem,
|
||||||
MM_BEARER_CONFIG, config,
|
MM_BEARER_CONFIG, config,
|
||||||
|
MM_BROADBAND_BEARER_SIERRA_IS_ICERA, is_icera,
|
||||||
NULL);
|
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
|
static void
|
||||||
mm_broadband_bearer_sierra_init (MMBroadbandBearerSierra *self)
|
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
|
static void
|
||||||
mm_broadband_bearer_sierra_class_init (MMBroadbandBearerSierraClass *klass)
|
mm_broadband_bearer_sierra_class_init (MMBroadbandBearerSierraClass *klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
MMBroadbandBearerClass *broadband_bearer_class = MM_BROADBAND_BEARER_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 = dial_3gpp;
|
||||||
broadband_bearer_class->dial_3gpp_finish = dial_3gpp_finish;
|
broadband_bearer_class->dial_3gpp_finish = dial_3gpp_finish;
|
||||||
broadband_bearer_class->disconnect_3gpp = disconnect_3gpp;
|
broadband_bearer_class->disconnect_3gpp = disconnect_3gpp;
|
||||||
broadband_bearer_class->disconnect_3gpp_finish = disconnect_3gpp_finish;
|
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));
|
||||||
}
|
}
|
||||||
|
@@ -36,9 +36,11 @@
|
|||||||
|
|
||||||
typedef struct _MMBroadbandBearerSierra MMBroadbandBearerSierra;
|
typedef struct _MMBroadbandBearerSierra MMBroadbandBearerSierra;
|
||||||
typedef struct _MMBroadbandBearerSierraClass MMBroadbandBearerSierraClass;
|
typedef struct _MMBroadbandBearerSierraClass MMBroadbandBearerSierraClass;
|
||||||
|
typedef struct _MMBroadbandBearerSierraPrivate MMBroadbandBearerSierraPrivate;
|
||||||
|
|
||||||
struct _MMBroadbandBearerSierra {
|
struct _MMBroadbandBearerSierra {
|
||||||
MMBroadbandBearer parent;
|
MMBroadbandBearer parent;
|
||||||
|
MMBroadbandBearerSierraPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MMBroadbandBearerSierraClass {
|
struct _MMBroadbandBearerSierraClass {
|
||||||
@@ -50,6 +52,7 @@ GType mm_broadband_bearer_sierra_get_type (void);
|
|||||||
/* Default 3GPP bearer creation implementation */
|
/* Default 3GPP bearer creation implementation */
|
||||||
void mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
|
void mm_broadband_bearer_sierra_new (MMBroadbandModem *modem,
|
||||||
MMBearerProperties *config,
|
MMBearerProperties *config,
|
||||||
|
gboolean is_icera,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
@@ -87,6 +87,7 @@ modem_create_bearer (MMIfaceModem *self,
|
|||||||
mm_dbg ("Creating Sierra bearer...");
|
mm_dbg ("Creating Sierra bearer...");
|
||||||
mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self),
|
mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self),
|
||||||
properties,
|
properties,
|
||||||
|
TRUE, /* is_icera */
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
|
(GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
|
||||||
result);
|
result);
|
||||||
|
@@ -1136,6 +1136,7 @@ modem_create_bearer (MMIfaceModem *self,
|
|||||||
mm_dbg ("Creating Sierra bearer...");
|
mm_dbg ("Creating Sierra bearer...");
|
||||||
mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self),
|
mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self),
|
||||||
properties,
|
properties,
|
||||||
|
FALSE, /* is_icera */
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
|
(GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
|
||||||
result);
|
result);
|
||||||
|
Reference in New Issue
Block a user