cinterion: extend SGAUTH syntax
AT^SGAUTH syntax depends on the modem family: AT^SGAUTH=cid,type,user,pwd for the IMT family AT^SGAUTH=cid,type,pwd,user for the rest
This commit is contained in:
@@ -197,9 +197,13 @@ parse_auth_type (MMBearerAllowedAuth mm_auth)
|
||||
}
|
||||
}
|
||||
|
||||
/* AT^SGAUTH=<cid>[, <auth_type>[, <passwd>, <user>]] */
|
||||
/* Cinterion authentication is done with the command AT^SGAUTH,
|
||||
whose syntax depends on the modem family, as follow:
|
||||
- AT^SGAUTH=<cid>[, <auth_type>[, <user>, <passwd>]] for the IMT family
|
||||
- AT^SGAUTH=<cid>[, <auth_type>[, <passwd>, <user>]] for the rest */
|
||||
static gchar *
|
||||
build_auth_string (MMBroadbandBearerCinterion *self,
|
||||
MMCinterionModemFamily modem_family,
|
||||
MMBearerProperties *config,
|
||||
guint cid)
|
||||
{
|
||||
@@ -241,6 +245,13 @@ build_auth_string (MMBroadbandBearerCinterion *self,
|
||||
quoted_user = mm_port_serial_at_quote_string (user ? user : "");
|
||||
quoted_passwd = mm_port_serial_at_quote_string (passwd ? passwd : "");
|
||||
|
||||
if (modem_family == MM_CINTERION_MODEM_FAMILY_IMT)
|
||||
return g_strdup_printf ("^SGAUTH=%u,%d,%s,%s",
|
||||
cid,
|
||||
encoded_auth,
|
||||
quoted_user,
|
||||
quoted_passwd);
|
||||
|
||||
return g_strdup_printf ("^SGAUTH=%u,%d,%s,%s",
|
||||
cid,
|
||||
encoded_auth,
|
||||
@@ -409,7 +420,11 @@ dial_3gpp_context_step (GTask *task)
|
||||
case DIAL_3GPP_CONTEXT_STEP_AUTH: {
|
||||
gchar *command;
|
||||
|
||||
command = build_auth_string (self, mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)), ctx->cid);
|
||||
command = build_auth_string (self,
|
||||
mm_broadband_modem_cinterion_get_family (MM_BROADBAND_MODEM_CINTERION (self)),
|
||||
mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)),
|
||||
ctx->cid);
|
||||
|
||||
if (command) {
|
||||
mm_obj_dbg (self, "dial step %u/%u: authenticating...", ctx->step, DIAL_3GPP_CONTEXT_STEP_LAST);
|
||||
/* Send SGAUTH write, if User & Pass are provided.
|
||||
|
||||
@@ -105,6 +105,14 @@ struct _MMBroadbandModemCinterionPrivate {
|
||||
MMBaseModemAtCommandAlloc *cmds;
|
||||
};
|
||||
|
||||
MMCinterionModemFamily
|
||||
mm_broadband_modem_cinterion_get_family (MMBroadbandModemCinterion * modem)
|
||||
{
|
||||
g_assert_nonnull (modem);
|
||||
return modem->priv->modem_family;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Enable unsolicited events (SMS indications) (Messaging interface) */
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define MM_BROADBAND_MODEM_CINTERION_H
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-modem-helpers-cinterion.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_CINTERION (mm_broadband_modem_cinterion_get_type ())
|
||||
#define MM_BROADBAND_MODEM_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_CINTERION, MMBroadbandModemCinterion))
|
||||
@@ -48,4 +49,6 @@ MMBroadbandModemCinterion *mm_broadband_modem_cinterion_new (const gchar *device
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
MMCinterionModemFamily mm_broadband_modem_cinterion_get_family (MMBroadbandModemCinterion * modem);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_CINTERION_H */
|
||||
|
||||
Reference in New Issue
Block a user