ublox: port to use object logging
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "mm-broadband-bearer-ublox.h"
|
||||
#include "mm-base-modem-at.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-ublox-enums-types.h"
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-modem-helpers-ublox.h"
|
||||
@@ -56,14 +56,12 @@ struct _MMBroadbandBearerUbloxPrivate {
|
||||
/* Common connection context and task */
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandBearerUblox *self;
|
||||
MMBroadbandModem *modem;
|
||||
MMPortSerialAt *primary;
|
||||
MMPort *data;
|
||||
guint cid;
|
||||
gboolean auth_required;
|
||||
/* For IPv4 settings */
|
||||
MMBearerIpConfig *ip_config;
|
||||
MMBroadbandModem *modem;
|
||||
MMPortSerialAt *primary;
|
||||
MMPort *data;
|
||||
guint cid;
|
||||
gboolean auth_required;
|
||||
MMBearerIpConfig *ip_config; /* For IPv4 settings */
|
||||
} CommonConnectContext;
|
||||
|
||||
static void
|
||||
@@ -73,7 +71,6 @@ common_connect_context_free (CommonConnectContext *ctx)
|
||||
g_object_unref (ctx->ip_config);
|
||||
if (ctx->data)
|
||||
g_object_unref (ctx->data);
|
||||
g_object_unref (ctx->self);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->primary);
|
||||
g_slice_free (CommonConnectContext, ctx);
|
||||
@@ -93,7 +90,6 @@ common_connect_task_new (MMBroadbandBearerUblox *self,
|
||||
GTask *task;
|
||||
|
||||
ctx = g_slice_new0 (CommonConnectContext);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->modem = g_object_ref (modem);
|
||||
ctx->primary = g_object_ref (primary);
|
||||
ctx->cid = cid;
|
||||
@@ -152,7 +148,7 @@ complete_get_ip_config_3gpp (GTask *task)
|
||||
{
|
||||
CommonConnectContext *ctx;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
g_assert (mm_bearer_ip_config_get_method (ctx->ip_config) != MM_BEARER_IP_METHOD_UNKNOWN);
|
||||
g_task_return_pointer (task,
|
||||
mm_bearer_connect_result_new (ctx->data, ctx->ip_config, NULL),
|
||||
@@ -165,14 +161,16 @@ cgcontrdp_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
CommonConnectContext *ctx;
|
||||
gchar *local_address = NULL;
|
||||
gchar *subnet = NULL;
|
||||
gchar *dns_addresses[3] = { NULL, NULL, NULL };
|
||||
MMBroadbandBearerUblox *self;
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
CommonConnectContext *ctx;
|
||||
gchar *local_address = NULL;
|
||||
gchar *subnet = NULL;
|
||||
gchar *dns_addresses[3] = { NULL, NULL, NULL };
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
if (!response || !mm_3gpp_parse_cgcontrdp_response (response,
|
||||
@@ -190,14 +188,14 @@ cgcontrdp_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("IPv4 address retrieved: %s", local_address);
|
||||
mm_obj_dbg (self, "IPv4 address retrieved: %s", local_address);
|
||||
mm_bearer_ip_config_set_address (ctx->ip_config, local_address);
|
||||
mm_dbg ("IPv4 subnet retrieved: %s", subnet);
|
||||
mm_obj_dbg (self, "IPv4 subnet retrieved: %s", subnet);
|
||||
mm_bearer_ip_config_set_prefix (ctx->ip_config, mm_netmask_to_cidr (subnet));
|
||||
if (dns_addresses[0])
|
||||
mm_dbg ("Primary DNS retrieved: %s", dns_addresses[0]);
|
||||
mm_obj_dbg (self, "primary DNS retrieved: %s", dns_addresses[0]);
|
||||
if (dns_addresses[1])
|
||||
mm_dbg ("Secondary DNS retrieved: %s", dns_addresses[1]);
|
||||
mm_obj_dbg (self, "secondary DNS retrieved: %s", dns_addresses[1]);
|
||||
mm_bearer_ip_config_set_dns (ctx->ip_config, (const gchar **) dns_addresses);
|
||||
|
||||
g_free (local_address);
|
||||
@@ -205,7 +203,7 @@ cgcontrdp_ready (MMBaseModem *modem,
|
||||
g_free (dns_addresses[0]);
|
||||
g_free (dns_addresses[1]);
|
||||
|
||||
mm_dbg ("finished IP settings retrieval for PDP context #%u...", ctx->cid);
|
||||
mm_obj_dbg (self, "finished IP settings retrieval for PDP context #%u...", ctx->cid);
|
||||
|
||||
complete_get_ip_config_3gpp (task);
|
||||
}
|
||||
@@ -215,13 +213,15 @@ uipaddr_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
const gchar *response;
|
||||
gchar *cmd;
|
||||
GError *error = NULL;
|
||||
CommonConnectContext *ctx;
|
||||
gchar *gw_ipv4_address = NULL;
|
||||
MMBroadbandBearerUblox *self;
|
||||
const gchar *response;
|
||||
gchar *cmd;
|
||||
GError *error = NULL;
|
||||
CommonConnectContext *ctx;
|
||||
gchar *gw_ipv4_address = NULL;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
if (!response || !mm_ublox_parse_uipaddr_response (response,
|
||||
@@ -237,12 +237,12 @@ uipaddr_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("IPv4 gateway address retrieved: %s", gw_ipv4_address);
|
||||
mm_obj_dbg (self, "IPv4 gateway address retrieved: %s", gw_ipv4_address);
|
||||
mm_bearer_ip_config_set_gateway (ctx->ip_config, gw_ipv4_address);
|
||||
g_free (gw_ipv4_address);
|
||||
|
||||
cmd = g_strdup_printf ("+CGCONTRDP=%u", ctx->cid);
|
||||
mm_dbg ("gathering IP and DNS information for PDP context #%u...", ctx->cid);
|
||||
mm_obj_dbg (self, "gathering IP and DNS information for PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (modem),
|
||||
cmd,
|
||||
10,
|
||||
@@ -253,7 +253,7 @@ uipaddr_ready (MMBaseModem *modem,
|
||||
}
|
||||
|
||||
static void
|
||||
get_ip_config_3gpp (MMBroadbandBearer *self,
|
||||
get_ip_config_3gpp (MMBroadbandBearer *_self,
|
||||
MMBroadbandModem *modem,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
@@ -263,8 +263,9 @@ get_ip_config_3gpp (MMBroadbandBearer *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
CommonConnectContext *ctx;
|
||||
MMBroadbandBearerUblox *self = MM_BROADBAND_BEARER_UBLOX (_self);
|
||||
GTask *task;
|
||||
CommonConnectContext *ctx;
|
||||
|
||||
if (!(task = common_connect_task_new (MM_BROADBAND_BEARER_UBLOX (self),
|
||||
MM_BROADBAND_MODEM (modem),
|
||||
@@ -276,20 +277,20 @@ get_ip_config_3gpp (MMBroadbandBearer *self,
|
||||
user_data)))
|
||||
return;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
ctx->ip_config = mm_bearer_ip_config_new ();
|
||||
|
||||
/* If we're in BRIDGE mode, we need to ask for static IP addressing details:
|
||||
* - AT+UIPADDR=[CID] will give us the default gateway address.
|
||||
* - +CGCONTRDP?[CID] will give us the IP address, subnet and DNS addresses.
|
||||
*/
|
||||
if (ctx->self->priv->mode == MM_UBLOX_NETWORKING_MODE_BRIDGE) {
|
||||
if (self->priv->mode == MM_UBLOX_NETWORKING_MODE_BRIDGE) {
|
||||
gchar *cmd;
|
||||
|
||||
mm_bearer_ip_config_set_method (ctx->ip_config, MM_BEARER_IP_METHOD_STATIC);
|
||||
|
||||
cmd = g_strdup_printf ("+UIPADDR=%u", cid);
|
||||
mm_dbg ("gathering gateway information for PDP context #%u...", cid);
|
||||
mm_obj_dbg (self, "gathering gateway information for PDP context #%u...", cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (modem),
|
||||
cmd,
|
||||
10,
|
||||
@@ -302,7 +303,7 @@ get_ip_config_3gpp (MMBroadbandBearer *self,
|
||||
|
||||
/* If we're in ROUTER networking mode, we just need to request DHCP on the
|
||||
* network interface. Early return with that result. */
|
||||
if (ctx->self->priv->mode == MM_UBLOX_NETWORKING_MODE_ROUTER) {
|
||||
if (self->priv->mode == MM_UBLOX_NETWORKING_MODE_ROUTER) {
|
||||
mm_bearer_ip_config_set_method (ctx->ip_config, MM_BEARER_IP_METHOD_DHCP);
|
||||
complete_get_ip_config_3gpp (task);
|
||||
return;
|
||||
@@ -332,7 +333,7 @@ cedata_activate_ready (MMBaseModem *modem,
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
if (!response) {
|
||||
mm_warn ("ECM data connection attempt failed: %s", error->message);
|
||||
mm_obj_warn (self, "ECM data connection attempt failed: %s", error->message);
|
||||
mm_base_bearer_report_connection_status (MM_BASE_BEARER (self),
|
||||
MM_BEARER_CONNECTION_STATUS_DISCONNECTED);
|
||||
g_error_free (error);
|
||||
@@ -350,7 +351,7 @@ cgact_activate_ready (MMBaseModem *modem,
|
||||
GError *error = NULL;
|
||||
CommonConnectContext *ctx;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
if (!response)
|
||||
@@ -363,40 +364,42 @@ cgact_activate_ready (MMBaseModem *modem,
|
||||
static void
|
||||
activate_3gpp (GTask *task)
|
||||
{
|
||||
CommonConnectContext *ctx;
|
||||
gchar *cmd;
|
||||
MMBroadbandBearerUblox *self;
|
||||
CommonConnectContext *ctx;
|
||||
g_autofree gchar *cmd = NULL;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (ctx->self->priv->profile == MM_UBLOX_USB_PROFILE_ECM &&
|
||||
ctx->self->priv->cedata == FEATURE_SUPPORTED) {
|
||||
/* SARA-U2xx and LISA-U20x only expose one CDC-ECM interface. Hence,
|
||||
the fixed 0 as the interface index here. When we see modems with
|
||||
multiple interfaces, this needs to be revisited. */
|
||||
/* SARA-U2xx and LISA-U20x only expose one CDC-ECM interface. Hence,
|
||||
* the fixed 0 as the interface index here. When we see modems with
|
||||
* multiple interfaces, this needs to be revisited. */
|
||||
if (self->priv->profile == MM_UBLOX_USB_PROFILE_ECM && self->priv->cedata == FEATURE_SUPPORTED) {
|
||||
cmd = g_strdup_printf ("+UCEDATA=%u,0", ctx->cid);
|
||||
mm_dbg ("establishing ECM data connection for PDP context #%u...", ctx->cid);
|
||||
mm_obj_dbg (self, "establishing ECM data connection for PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
cmd,
|
||||
180,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cedata_activate_ready,
|
||||
g_object_ref (ctx->self));
|
||||
g_object_ref (self));
|
||||
|
||||
/* We'll mark the task done here since the modem expects the DHCP
|
||||
discover packet while +UCEDATA runs. If the command fails, we'll
|
||||
mark the bearer disconnected later in the callback. */
|
||||
g_task_return_pointer (task, g_object_ref (ctx->data), g_object_unref);
|
||||
g_object_unref (task);
|
||||
} else {
|
||||
cmd = g_strdup_printf ("+CGACT=1,%u", ctx->cid);
|
||||
mm_dbg ("activating PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
cmd,
|
||||
120,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cgact_activate_ready,
|
||||
task);
|
||||
}
|
||||
g_free (cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
cmd = g_strdup_printf ("+CGACT=1,%u", ctx->cid);
|
||||
mm_obj_dbg (self, "activating PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
cmd,
|
||||
120,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cgact_activate_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -404,18 +407,18 @@ test_cedata_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
CommonConnectContext *ctx;
|
||||
const gchar *response;
|
||||
MMBroadbandBearerUblox *self;
|
||||
const gchar *response;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, NULL);
|
||||
if (response)
|
||||
ctx->self->priv->cedata = FEATURE_SUPPORTED;
|
||||
self->priv->cedata = FEATURE_SUPPORTED;
|
||||
else
|
||||
ctx->self->priv->cedata = FEATURE_UNSUPPORTED;
|
||||
mm_dbg ("u-blox: +UCEDATA command%s available",
|
||||
(ctx->self->priv->cedata == FEATURE_SUPPORTED) ? "" : " not");
|
||||
self->priv->cedata = FEATURE_UNSUPPORTED;
|
||||
mm_obj_dbg (self, "u-blox: +UCEDATA command%s available",
|
||||
(self->priv->cedata == FEATURE_SUPPORTED) ? "" : " not");
|
||||
|
||||
activate_3gpp (task);
|
||||
}
|
||||
@@ -423,19 +426,20 @@ test_cedata_ready (MMBaseModem *modem,
|
||||
static void
|
||||
test_cedata (GTask *task)
|
||||
{
|
||||
CommonConnectContext *ctx;
|
||||
MMBroadbandBearerUblox *self;
|
||||
CommonConnectContext *ctx;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
/* We don't need to test for +UCEDATA if we're not using CDC-ECM or if we
|
||||
have tested before. Instead, we jump right to the activation. */
|
||||
if (ctx->self->priv->profile != MM_UBLOX_USB_PROFILE_ECM ||
|
||||
ctx->self->priv->cedata != FEATURE_SUPPORT_UNKNOWN) {
|
||||
if (self->priv->profile != MM_UBLOX_USB_PROFILE_ECM || self->priv->cedata != FEATURE_SUPPORT_UNKNOWN) {
|
||||
activate_3gpp (task);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("u-blox: checking availability of +UCEDATA command...");
|
||||
mm_obj_dbg (self, "u-blox: checking availability of +UCEDATA command...");
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
"+UCEDATA=?",
|
||||
3,
|
||||
@@ -456,7 +460,7 @@ uauthreq_ready (MMBaseModem *modem,
|
||||
if (!response) {
|
||||
CommonConnectContext *ctx;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
/* If authentication required and the +UAUTHREQ failed, abort */
|
||||
if (ctx->auth_required) {
|
||||
g_task_return_error (task, error);
|
||||
@@ -475,23 +479,23 @@ authenticate_3gpp (GTask *task)
|
||||
{
|
||||
MMBroadbandBearerUblox *self;
|
||||
CommonConnectContext *ctx;
|
||||
gchar *cmd = NULL;
|
||||
g_autofree gchar *cmd = NULL;
|
||||
MMBearerAllowedAuth allowed_auth;
|
||||
gint ublox_auth = -1;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
allowed_auth = mm_bearer_properties_get_allowed_auth (mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)));
|
||||
allowed_auth = mm_bearer_properties_get_allowed_auth (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
|
||||
if (!ctx->auth_required) {
|
||||
mm_dbg ("Not using authentication");
|
||||
mm_obj_dbg (self, "not using authentication");
|
||||
ublox_auth = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (allowed_auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN || allowed_auth == (MM_BEARER_ALLOWED_AUTH_PAP | MM_BEARER_ALLOWED_AUTH_CHAP)) {
|
||||
mm_dbg ("Using automatic authentication method");
|
||||
mm_obj_dbg (self, "using automatic authentication method");
|
||||
if (self->priv->allowed_auths & MM_UBLOX_BEARER_ALLOWED_AUTH_AUTO)
|
||||
ublox_auth = 3;
|
||||
else if (self->priv->allowed_auths & MM_UBLOX_BEARER_ALLOWED_AUTH_PAP)
|
||||
@@ -501,34 +505,33 @@ authenticate_3gpp (GTask *task)
|
||||
else if (self->priv->allowed_auths & MM_UBLOX_BEARER_ALLOWED_AUTH_NONE)
|
||||
ublox_auth = 0;
|
||||
} else if (allowed_auth & MM_BEARER_ALLOWED_AUTH_PAP) {
|
||||
mm_dbg ("Using PAP authentication method");
|
||||
mm_obj_dbg (self, "using PAP authentication method");
|
||||
ublox_auth = 1;
|
||||
} else if (allowed_auth & MM_BEARER_ALLOWED_AUTH_CHAP) {
|
||||
mm_dbg ("Using CHAP authentication method");
|
||||
mm_obj_dbg (self, "using CHAP authentication method");
|
||||
ublox_auth = 2;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
if (ublox_auth < 0) {
|
||||
gchar *str;
|
||||
g_autofree gchar *str = NULL;
|
||||
|
||||
str = mm_bearer_allowed_auth_build_string_from_mask (allowed_auth);
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot use any of the specified authentication methods (%s)", str);
|
||||
g_object_unref (task);
|
||||
g_free (str);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ublox_auth > 0) {
|
||||
const gchar *user;
|
||||
const gchar *password;
|
||||
gchar *quoted_user;
|
||||
gchar *quoted_password;
|
||||
const gchar *user;
|
||||
const gchar *password;
|
||||
g_autofree gchar *quoted_user = NULL;
|
||||
g_autofree gchar *quoted_password = NULL;
|
||||
|
||||
user = mm_bearer_properties_get_user (mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)));
|
||||
password = mm_bearer_properties_get_password (mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)));
|
||||
user = mm_bearer_properties_get_user (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
password = mm_bearer_properties_get_password (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
|
||||
quoted_user = mm_port_serial_at_quote_string (user);
|
||||
quoted_password = mm_port_serial_at_quote_string (password);
|
||||
@@ -538,20 +541,16 @@ out:
|
||||
ublox_auth,
|
||||
quoted_user,
|
||||
quoted_password);
|
||||
|
||||
g_free (quoted_user);
|
||||
g_free (quoted_password);
|
||||
} else
|
||||
cmd = g_strdup_printf ("+UAUTHREQ=%u,0,\"\",\"\"", ctx->cid);
|
||||
|
||||
mm_dbg ("setting up authentication preferences in PDP context #%u...", ctx->cid);
|
||||
mm_obj_dbg (self, "setting up authentication preferences in PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
cmd,
|
||||
10,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) uauthreq_ready,
|
||||
task);
|
||||
g_free (cmd);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -569,12 +568,12 @@ uauthreq_test_ready (MMBaseModem *modem,
|
||||
if (!response)
|
||||
goto out;
|
||||
|
||||
self->priv->allowed_auths = mm_ublox_parse_uauthreq_test (response, &error);
|
||||
self->priv->allowed_auths = mm_ublox_parse_uauthreq_test (response, self, &error);
|
||||
out:
|
||||
if (error) {
|
||||
CommonConnectContext *ctx;
|
||||
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
/* If authentication required and the +UAUTHREQ test failed, abort */
|
||||
if (ctx->auth_required) {
|
||||
g_task_return_error (task, error);
|
||||
@@ -601,11 +600,11 @@ check_supported_authentication_methods (GTask *task)
|
||||
MMBearerAllowedAuth allowed_auth;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = (CommonConnectContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
user = mm_bearer_properties_get_user (mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)));
|
||||
password = mm_bearer_properties_get_password (mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)));
|
||||
allowed_auth = mm_bearer_properties_get_allowed_auth (mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)));
|
||||
user = mm_bearer_properties_get_user (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
password = mm_bearer_properties_get_password (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
allowed_auth = mm_bearer_properties_get_allowed_auth (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
|
||||
/* Flag whether authentication is required. If it isn't, we won't fail
|
||||
* connection attempt if the +UAUTHREQ command fails */
|
||||
@@ -617,7 +616,7 @@ check_supported_authentication_methods (GTask *task)
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("checking supported authentication methods...");
|
||||
mm_obj_dbg (self, "checking supported authentication methods...");
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
"+UAUTHREQ=?",
|
||||
10,
|
||||
@@ -666,8 +665,11 @@ cgact_deactivate_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
MMBroadbandBearerUblox *self;
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
if (!response) {
|
||||
@@ -693,7 +695,7 @@ cgact_deactivate_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("ignored error when disconnecting last LTE bearer: %s", error->message);
|
||||
mm_obj_dbg (self, "ignored error when disconnecting last LTE bearer: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
@@ -711,8 +713,8 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
gchar *cmd;
|
||||
GTask *task;
|
||||
g_autofree gchar *cmd = NULL;
|
||||
|
||||
if (!(task = common_connect_task_new (MM_BROADBAND_BEARER_UBLOX (self),
|
||||
MM_BROADBAND_MODEM (modem),
|
||||
@@ -725,14 +727,13 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
return;
|
||||
|
||||
cmd = g_strdup_printf ("+CGACT=0,%u", cid);
|
||||
mm_dbg ("deactivating PDP context #%u...", cid);
|
||||
mm_obj_dbg (self, "deactivating PDP context #%u...", cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (modem),
|
||||
cmd,
|
||||
120,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cgact_deactivate_ready,
|
||||
task);
|
||||
g_free (cmd);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-iface-modem-voice.h"
|
||||
@@ -87,7 +87,7 @@ preload_support_config (MMBroadbandModemUblox *self)
|
||||
model = mm_iface_modem_get_model (MM_IFACE_MODEM (self));
|
||||
|
||||
if (!mm_ublox_get_support_config (model, &self->priv->support_config, &error)) {
|
||||
mm_warn ("loading support configuration failed: %s", error->message);
|
||||
mm_obj_warn (self, "loading support configuration failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
/* default to NOT SUPPORTED if unknown model */
|
||||
@@ -95,14 +95,14 @@ preload_support_config (MMBroadbandModemUblox *self)
|
||||
self->priv->support_config.uact = FEATURE_UNSUPPORTED;
|
||||
self->priv->support_config.ubandsel = FEATURE_UNSUPPORTED;
|
||||
} else
|
||||
mm_dbg ("support configuration found for '%s'", model);
|
||||
mm_obj_dbg (self, "support configuration found for '%s'", model);
|
||||
|
||||
switch (self->priv->support_config.method) {
|
||||
case SETTINGS_UPDATE_METHOD_CFUN:
|
||||
mm_dbg (" band update requires low-power mode");
|
||||
mm_obj_dbg (self, " band update requires low-power mode");
|
||||
break;
|
||||
case SETTINGS_UPDATE_METHOD_COPS:
|
||||
mm_dbg (" band update requires explicit unregistration");
|
||||
mm_obj_dbg (self, " band update requires explicit unregistration");
|
||||
break;
|
||||
case SETTINGS_UPDATE_METHOD_UNKNOWN:
|
||||
/* not an error, this just means we don't need anything special */
|
||||
@@ -113,10 +113,10 @@ preload_support_config (MMBroadbandModemUblox *self)
|
||||
|
||||
switch (self->priv->support_config.uact) {
|
||||
case FEATURE_SUPPORTED:
|
||||
mm_dbg (" UACT based band configuration supported");
|
||||
mm_obj_dbg (self, " UACT based band configuration supported");
|
||||
break;
|
||||
case FEATURE_UNSUPPORTED:
|
||||
mm_dbg (" UACT based band configuration unsupported");
|
||||
mm_obj_dbg (self, " UACT based band configuration unsupported");
|
||||
break;
|
||||
case FEATURE_SUPPORT_UNKNOWN:
|
||||
default:
|
||||
@@ -125,10 +125,10 @@ preload_support_config (MMBroadbandModemUblox *self)
|
||||
|
||||
switch (self->priv->support_config.ubandsel) {
|
||||
case FEATURE_SUPPORTED:
|
||||
mm_dbg (" UBANDSEL based band configuration supported");
|
||||
mm_obj_dbg (self, " UBANDSEL based band configuration supported");
|
||||
break;
|
||||
case FEATURE_UNSUPPORTED:
|
||||
mm_dbg (" UBANDSEL based band configuration unsupported");
|
||||
mm_obj_dbg (self, " UBANDSEL based band configuration unsupported");
|
||||
break;
|
||||
case FEATURE_SUPPORT_UNKNOWN:
|
||||
default:
|
||||
@@ -182,7 +182,7 @@ load_supported_bands (MMIfaceModem *self,
|
||||
model = mm_iface_modem_get_model (self);
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
bands = mm_ublox_get_supported_bands (model, &error);
|
||||
bands = mm_ublox_get_supported_bands (model, self, &error);
|
||||
if (!bands)
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
@@ -246,7 +246,7 @@ ubandsel_load_current_bands_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
model = mm_iface_modem_get_model (MM_IFACE_MODEM (self));
|
||||
out = mm_ublox_parse_ubandsel_response (response, model, &error);
|
||||
out = mm_ublox_parse_ubandsel_response (response, model, self, &error);
|
||||
if (!out) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
@@ -311,7 +311,6 @@ typedef enum {
|
||||
} SetCurrentModesBandsStep;
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandModemUblox *self;
|
||||
SetCurrentModesBandsStep step;
|
||||
gchar *command;
|
||||
MMModemPowerState initial_state;
|
||||
@@ -323,19 +322,16 @@ set_current_modes_bands_context_free (SetCurrentModesBandsContext *ctx)
|
||||
{
|
||||
g_assert (!ctx->saved_error);
|
||||
g_free (ctx->command);
|
||||
g_object_unref (ctx->self);
|
||||
g_slice_free (SetCurrentModesBandsContext, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_current_modes_bands_context_new (GTask *task,
|
||||
MMIfaceModem *self,
|
||||
gchar *command)
|
||||
set_current_modes_bands_context_new (GTask *task,
|
||||
gchar *command)
|
||||
{
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
|
||||
ctx = g_slice_new0 (SetCurrentModesBandsContext);
|
||||
ctx->self = MM_BROADBAND_MODEM_UBLOX (g_object_ref (self));
|
||||
ctx->command = command;
|
||||
ctx->initial_state = MM_MODEM_POWER_STATE_UNKNOWN;
|
||||
ctx->step = SET_CURRENT_MODES_BANDS_STEP_FIRST;
|
||||
@@ -359,8 +355,7 @@ set_current_modes_bands_reregister_in_network_ready (MMIfaceModem3gpp *self,
|
||||
{
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
|
||||
ctx = (SetCurrentModesBandsContext *) g_task_get_task_data (task);
|
||||
g_assert (ctx);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
/* propagate the error if none already set */
|
||||
mm_iface_modem_3gpp_reregister_in_network_finish (self, res, ctx->saved_error ? NULL : &ctx->saved_error);
|
||||
@@ -377,8 +372,7 @@ set_current_modes_bands_after_command_ready (MMBaseModem *self,
|
||||
{
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
|
||||
ctx = (SetCurrentModesBandsContext *) g_task_get_task_data (task);
|
||||
g_assert (ctx);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
/* propagate the error if none already set */
|
||||
mm_base_modem_at_command_finish (self, res, ctx->saved_error ? NULL : &ctx->saved_error);
|
||||
@@ -395,8 +389,7 @@ set_current_modes_bands_command_ready (MMBaseModem *self,
|
||||
{
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
|
||||
ctx = (SetCurrentModesBandsContext *) g_task_get_task_data (task);
|
||||
g_assert (ctx);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!mm_base_modem_at_command_finish (self, res, &ctx->saved_error))
|
||||
ctx->step = SET_CURRENT_MODES_BANDS_STEP_RELEASE;
|
||||
@@ -413,8 +406,7 @@ set_current_modes_bands_before_command_ready (MMBaseModem *self,
|
||||
{
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
|
||||
ctx = (SetCurrentModesBandsContext *) g_task_get_task_data (task);
|
||||
g_assert (ctx);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!mm_base_modem_at_command_finish (self, res, &ctx->saved_error))
|
||||
ctx->step = SET_CURRENT_MODES_BANDS_STEP_RELEASE;
|
||||
@@ -425,18 +417,19 @@ set_current_modes_bands_before_command_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_current_modes_bands_current_power_ready (MMBaseModem *self,
|
||||
set_current_modes_bands_current_power_ready (MMBaseModem *_self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
const gchar *response;
|
||||
|
||||
ctx = (SetCurrentModesBandsContext *) g_task_get_task_data (task);
|
||||
g_assert (ctx);
|
||||
g_assert (ctx->self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (self, res, &ctx->saved_error);
|
||||
g_assert (self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN);
|
||||
|
||||
response = mm_base_modem_at_command_finish (_self, res, &ctx->saved_error);
|
||||
if (!response || !mm_ublox_parse_cfun_response (response, &ctx->initial_state, &ctx->saved_error))
|
||||
ctx->step = SET_CURRENT_MODES_BANDS_STEP_RELEASE;
|
||||
else
|
||||
@@ -448,10 +441,11 @@ set_current_modes_bands_current_power_ready (MMBaseModem *self,
|
||||
static void
|
||||
set_current_modes_bands_step (GTask *task)
|
||||
{
|
||||
MMBroadbandModemUblox *self;
|
||||
SetCurrentModesBandsContext *ctx;
|
||||
|
||||
ctx = (SetCurrentModesBandsContext *) g_task_get_task_data (task);
|
||||
g_assert (ctx);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
switch (ctx->step) {
|
||||
case SET_CURRENT_MODES_BANDS_STEP_FIRST:
|
||||
@@ -459,8 +453,8 @@ set_current_modes_bands_step (GTask *task)
|
||||
/* fall through */
|
||||
|
||||
case SET_CURRENT_MODES_BANDS_STEP_ACQUIRE:
|
||||
mm_dbg ("acquiring power operation...");
|
||||
if (!acquire_power_operation (ctx->self, &ctx->saved_error)) {
|
||||
mm_obj_dbg (self, "acquiring power operation...");
|
||||
if (!acquire_power_operation (self, &ctx->saved_error)) {
|
||||
ctx->step = SET_CURRENT_MODES_BANDS_STEP_LAST;
|
||||
set_current_modes_bands_step (task);
|
||||
return;
|
||||
@@ -472,9 +466,9 @@ set_current_modes_bands_step (GTask *task)
|
||||
/* If using CFUN, we check whether we're already in low-power mode.
|
||||
* And if we are, we just skip triggering low-power mode ourselves.
|
||||
*/
|
||||
if (ctx->self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN) {
|
||||
mm_dbg ("checking current power operation...");
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->self),
|
||||
if (self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN) {
|
||||
mm_obj_dbg (self, "checking current power operation...");
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CFUN?",
|
||||
3,
|
||||
FALSE,
|
||||
@@ -487,10 +481,10 @@ set_current_modes_bands_step (GTask *task)
|
||||
|
||||
case SET_CURRENT_MODES_BANDS_STEP_BEFORE_COMMAND:
|
||||
/* If COPS required around the set command, run it unconditionally */
|
||||
if (ctx->self->priv->support_config.method == SETTINGS_UPDATE_METHOD_COPS) {
|
||||
mm_dbg ("deregistering from the network for configuration change...");
|
||||
if (self->priv->support_config.method == SETTINGS_UPDATE_METHOD_COPS) {
|
||||
mm_obj_dbg (self, "deregistering from the network for configuration change...");
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM (self),
|
||||
"+COPS=2",
|
||||
10,
|
||||
FALSE,
|
||||
@@ -499,12 +493,12 @@ set_current_modes_bands_step (GTask *task)
|
||||
return;
|
||||
}
|
||||
/* If CFUN required, check initial state before triggering low-power mode ourselves */
|
||||
else if (ctx->self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN) {
|
||||
else if (self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN) {
|
||||
/* Do nothing if already in low-power mode */
|
||||
if (ctx->initial_state != MM_MODEM_POWER_STATE_LOW) {
|
||||
mm_dbg ("powering down for configuration change...");
|
||||
mm_obj_dbg (self, "powering down for configuration change...");
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM (self),
|
||||
"+CFUN=4",
|
||||
3,
|
||||
FALSE,
|
||||
@@ -518,9 +512,9 @@ set_current_modes_bands_step (GTask *task)
|
||||
/* fall through */
|
||||
|
||||
case SET_CURRENT_MODES_BANDS_STEP_COMMAND:
|
||||
mm_dbg ("updating configuration...");
|
||||
mm_obj_dbg (self, "updating configuration...");
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM (self),
|
||||
ctx->command,
|
||||
3,
|
||||
FALSE,
|
||||
@@ -530,20 +524,20 @@ set_current_modes_bands_step (GTask *task)
|
||||
|
||||
case SET_CURRENT_MODES_BANDS_STEP_AFTER_COMMAND:
|
||||
/* If COPS required around the set command, run it unconditionally */
|
||||
if (ctx->self->priv->support_config.method == SETTINGS_UPDATE_METHOD_COPS) {
|
||||
mm_iface_modem_3gpp_reregister_in_network (MM_IFACE_MODEM_3GPP (ctx->self),
|
||||
if (self->priv->support_config.method == SETTINGS_UPDATE_METHOD_COPS) {
|
||||
mm_iface_modem_3gpp_reregister_in_network (MM_IFACE_MODEM_3GPP (self),
|
||||
(GAsyncReadyCallback) set_current_modes_bands_reregister_in_network_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
/* If CFUN required, see if we need to recover power */
|
||||
else if (ctx->self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN) {
|
||||
else if (self->priv->support_config.method == SETTINGS_UPDATE_METHOD_CFUN) {
|
||||
/* If we were in low-power mode before the change, do nothing, otherwise,
|
||||
* full power mode back */
|
||||
if (ctx->initial_state != MM_MODEM_POWER_STATE_LOW) {
|
||||
mm_dbg ("recovering power state after configuration change...");
|
||||
mm_obj_dbg (self, "recovering power state after configuration change...");
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM (self),
|
||||
"+CFUN=1",
|
||||
3,
|
||||
FALSE,
|
||||
@@ -556,8 +550,8 @@ set_current_modes_bands_step (GTask *task)
|
||||
/* fall through */
|
||||
|
||||
case SET_CURRENT_MODES_BANDS_STEP_RELEASE:
|
||||
mm_dbg ("releasing power operation...");
|
||||
release_power_operation (ctx->self);
|
||||
mm_obj_dbg (self, "releasing power operation...");
|
||||
release_power_operation (self);
|
||||
ctx->step++;
|
||||
/* fall through */
|
||||
|
||||
@@ -602,7 +596,7 @@ set_current_modes (MMIfaceModem *self,
|
||||
return;
|
||||
}
|
||||
|
||||
set_current_modes_bands_context_new (task, self, command);
|
||||
set_current_modes_bands_context_new (task, command);
|
||||
set_current_modes_bands_step (task);
|
||||
}
|
||||
|
||||
@@ -636,7 +630,7 @@ set_current_bands (MMIfaceModem *_self,
|
||||
return;
|
||||
}
|
||||
|
||||
set_current_modes_bands_context_new (task, _self, command);
|
||||
set_current_modes_bands_context_new (task, command);
|
||||
set_current_modes_bands_step (task);
|
||||
}
|
||||
|
||||
@@ -656,7 +650,7 @@ load_current_modes_finish (MMIfaceModem *self,
|
||||
if (!response)
|
||||
return FALSE;
|
||||
|
||||
return mm_ublox_parse_urat_read_response (response, allowed, preferred, error);
|
||||
return mm_ublox_parse_urat_read_response (response, self, allowed, preferred, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -687,7 +681,7 @@ load_supported_modes_finish (MMIfaceModem *self,
|
||||
if (!response)
|
||||
return FALSE;
|
||||
|
||||
if (!(combinations = mm_ublox_parse_urat_test_response (response, error)))
|
||||
if (!(combinations = mm_ublox_parse_urat_test_response (response, self, error)))
|
||||
return FALSE;
|
||||
|
||||
if (!(combinations = mm_ublox_filter_supported_modes (mm_iface_modem_get_model (self), combinations, self, error)))
|
||||
@@ -929,9 +923,9 @@ udtmfd_ready (MMBaseModem *self,
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (self, res, &error)) {
|
||||
mm_dbg ("Couldn't %s +UUDTMFD reporting: '%s'",
|
||||
ctx->enable ? "enable" : "disable",
|
||||
error->message);
|
||||
mm_obj_dbg (self, "couldn't %s +UUDTMFD reporting: '%s'",
|
||||
ctx->enable ? "enable" : "disable",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -950,9 +944,9 @@ ucallstat_ready (MMBaseModem *self,
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (self, res, &error)) {
|
||||
mm_dbg ("Couldn't %s +UCALLSTAT reporting: '%s'",
|
||||
ctx->enable ? "enable" : "disable",
|
||||
error->message);
|
||||
mm_obj_dbg (self, "couldn't %s +UCALLSTAT reporting: '%s'",
|
||||
ctx->enable ? "enable" : "disable",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -966,7 +960,7 @@ voice_unsolicited_events_context_step (GTask *task)
|
||||
MMBroadbandModemUblox *self;
|
||||
VoiceUnsolicitedEventsContext *ctx;
|
||||
|
||||
self = MM_BROADBAND_MODEM_UBLOX (g_task_get_source_object (task));
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
switch (ctx->step) {
|
||||
@@ -976,8 +970,8 @@ voice_unsolicited_events_context_step (GTask *task)
|
||||
|
||||
case VOICE_UNSOLICITED_EVENTS_STEP_UCALLSTAT_PRIMARY:
|
||||
if (ctx->primary) {
|
||||
mm_dbg ("%s extended call status reporting in primary port...",
|
||||
ctx->enable ? "Enabling" : "Disabling");
|
||||
mm_obj_dbg (self, "%s extended call status reporting in primary port...",
|
||||
ctx->enable ? "enabling" : "disabling");
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (self),
|
||||
ctx->primary,
|
||||
ctx->ucallstat_command,
|
||||
@@ -994,8 +988,8 @@ voice_unsolicited_events_context_step (GTask *task)
|
||||
|
||||
case VOICE_UNSOLICITED_EVENTS_STEP_UCALLSTAT_SECONDARY:
|
||||
if (ctx->secondary) {
|
||||
mm_dbg ("%s extended call status reporting in secondary port...",
|
||||
ctx->enable ? "Enabling" : "Disabling");
|
||||
mm_obj_dbg (self, "%s extended call status reporting in secondary port...",
|
||||
ctx->enable ? "enabling" : "disabling");
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (self),
|
||||
ctx->secondary,
|
||||
ctx->ucallstat_command,
|
||||
@@ -1012,8 +1006,8 @@ voice_unsolicited_events_context_step (GTask *task)
|
||||
|
||||
case VOICE_UNSOLICITED_EVENTS_STEP_UDTMFD_PRIMARY:
|
||||
if ((self->priv->udtmfd_support == FEATURE_SUPPORTED) && (ctx->primary)) {
|
||||
mm_dbg ("%s DTMF detection and reporting in primary port...",
|
||||
ctx->enable ? "Enabling" : "Disabling");
|
||||
mm_obj_dbg (self, "%s DTMF detection and reporting in primary port...",
|
||||
ctx->enable ? "enabling" : "disabling");
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (self),
|
||||
ctx->primary,
|
||||
ctx->udtmfd_command,
|
||||
@@ -1030,8 +1024,8 @@ voice_unsolicited_events_context_step (GTask *task)
|
||||
|
||||
case VOICE_UNSOLICITED_EVENTS_STEP_UDTMFD_SECONDARY:
|
||||
if ((self->priv->udtmfd_support == FEATURE_SUPPORTED) && (ctx->secondary)) {
|
||||
mm_dbg ("%s DTMF detection and reporting in secondary port...",
|
||||
ctx->enable ? "Enabling" : "Disabling");
|
||||
mm_obj_dbg (self, "%s DTMF detection and reporting in secondary port...",
|
||||
ctx->enable ? "enabling" : "disabling");
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (self),
|
||||
ctx->secondary,
|
||||
ctx->udtmfd_command,
|
||||
@@ -1103,7 +1097,7 @@ voice_enable_unsolicited_events_ready (MMBroadbandModemUblox *self,
|
||||
GError *error = NULL;
|
||||
|
||||
if (!common_voice_enable_disable_unsolicited_events_finish (self, res, &error)) {
|
||||
mm_warn ("Couldn't enable u-blox-specific voice unsolicited events: %s", error->message);
|
||||
mm_obj_warn (self, "Couldn't enable u-blox-specific voice unsolicited events: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -1182,7 +1176,7 @@ voice_disable_unsolicited_events_ready (MMBroadbandModemUblox *self,
|
||||
GError *error = NULL;
|
||||
|
||||
if (!common_voice_enable_disable_unsolicited_events_finish (self, res, &error)) {
|
||||
mm_warn ("Couldn't disable u-blox-specific voice unsolicited events: %s", error->message);
|
||||
mm_obj_warn (self, "Couldn't disable u-blox-specific voice unsolicited events: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -1230,14 +1224,14 @@ ucallstat_received (MMPortSerialAt *port,
|
||||
guint aux;
|
||||
|
||||
if (!mm_get_uint_from_match_info (match_info, 1, &aux)) {
|
||||
mm_warn ("couldn't parse call index from +UCALLSTAT");
|
||||
mm_obj_warn (self, "couldn't parse call index from +UCALLSTAT");
|
||||
return;
|
||||
}
|
||||
call_info.index = aux;
|
||||
|
||||
if (!mm_get_uint_from_match_info (match_info, 2, &aux) ||
|
||||
(aux >= G_N_ELEMENTS (ublox_call_state))) {
|
||||
mm_warn ("couldn't parse call state from +UCALLSTAT");
|
||||
mm_obj_warn (self, "couldn't parse call state from +UCALLSTAT");
|
||||
return;
|
||||
}
|
||||
call_info.state = ublox_call_state[aux];
|
||||
@@ -1269,13 +1263,12 @@ udtmfd_received (MMPortSerialAt *port,
|
||||
GMatchInfo *match_info,
|
||||
MMBroadbandModemUblox *self)
|
||||
{
|
||||
gchar *dtmf;
|
||||
g_autofree gchar *dtmf = NULL;
|
||||
|
||||
dtmf = g_match_info_fetch (match_info, 1);
|
||||
mm_dbg ("received DTMF: %s", dtmf);
|
||||
mm_obj_dbg (self, "received DTMF: %s", dtmf);
|
||||
/* call index unknown */
|
||||
mm_iface_modem_voice_received_dtmf (MM_IFACE_MODEM_VOICE (self), 0, dtmf);
|
||||
g_free (dtmf);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1333,7 +1326,7 @@ parent_voice_cleanup_unsolicited_events_ready (MMIfaceModemVoice *self,
|
||||
GError *error = NULL;
|
||||
|
||||
if (!iface_modem_voice_parent->cleanup_unsolicited_events_finish (self, res, &error)) {
|
||||
mm_warn ("Couldn't cleanup parent voice unsolicited events: %s", error->message);
|
||||
mm_obj_warn (self, "Couldn't cleanup parent voice unsolicited events: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -1379,7 +1372,7 @@ parent_voice_setup_unsolicited_events_ready (MMIfaceModemVoice *self,
|
||||
GError *error = NULL;
|
||||
|
||||
if (!iface_modem_voice_parent->setup_unsolicited_events_finish (self, res, &error)) {
|
||||
mm_warn ("Couldn't setup parent voice unsolicited events: %s", error->message);
|
||||
mm_obj_warn (self, "Couldn't setup parent voice unsolicited events: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -1497,20 +1490,17 @@ typedef enum {
|
||||
} CreateBearerStep;
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandModemUblox *self;
|
||||
CreateBearerStep step;
|
||||
MMBearerProperties *properties;
|
||||
MMBaseBearer *bearer;
|
||||
gboolean has_net;
|
||||
CreateBearerStep step;
|
||||
MMBearerProperties *properties;
|
||||
MMBaseBearer *bearer;
|
||||
gboolean has_net;
|
||||
} CreateBearerContext;
|
||||
|
||||
static void
|
||||
create_bearer_context_free (CreateBearerContext *ctx)
|
||||
{
|
||||
if (ctx->bearer)
|
||||
g_object_unref (ctx->bearer);
|
||||
g_clear_object (&ctx->bearer);
|
||||
g_object_unref (ctx->properties);
|
||||
g_object_unref (ctx->self);
|
||||
g_slice_free (CreateBearerContext, ctx);
|
||||
}
|
||||
|
||||
@@ -1529,10 +1519,12 @@ broadband_bearer_new_ready (GObject *source,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
CreateBearerContext *ctx;
|
||||
GError *error = NULL;
|
||||
MMBroadbandModemUblox *self;
|
||||
CreateBearerContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = (CreateBearerContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
g_assert (!ctx->bearer);
|
||||
ctx->bearer = mm_broadband_bearer_new_finish (res, &error);
|
||||
@@ -1542,7 +1534,7 @@ broadband_bearer_new_ready (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("u-blox: new generic broadband bearer created at DBus path '%s'", mm_base_bearer_get_path (ctx->bearer));
|
||||
mm_obj_dbg (self, "new generic broadband bearer created at DBus path '%s'", mm_base_bearer_get_path (ctx->bearer));
|
||||
ctx->step++;
|
||||
create_bearer_step (task);
|
||||
}
|
||||
@@ -1552,10 +1544,12 @@ broadband_bearer_ublox_new_ready (GObject *source,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
CreateBearerContext *ctx;
|
||||
GError *error = NULL;
|
||||
MMBroadbandModemUblox *self;
|
||||
CreateBearerContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = (CreateBearerContext *) g_task_get_task_data (task);
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
g_assert (!ctx->bearer);
|
||||
ctx->bearer = mm_broadband_bearer_ublox_new_finish (res, &error);
|
||||
@@ -1565,74 +1559,76 @@ broadband_bearer_ublox_new_ready (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("u-blox: new u-blox broadband bearer created at DBus path '%s'", mm_base_bearer_get_path (ctx->bearer));
|
||||
mm_obj_dbg (self, "new u-blox broadband bearer created at DBus path '%s'", mm_base_bearer_get_path (ctx->bearer));
|
||||
ctx->step++;
|
||||
create_bearer_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
mode_check_ready (MMBaseModem *self,
|
||||
mode_check_ready (MMBaseModem *_self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
CreateBearerContext *ctx;
|
||||
MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
CreateBearerContext *ctx;
|
||||
|
||||
ctx = (CreateBearerContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (self, res, &error);
|
||||
response = mm_base_modem_at_command_finish (_self, res, &error);
|
||||
if (!response) {
|
||||
mm_dbg ("u-blox: couldn't load current networking mode: %s", error->message);
|
||||
mm_obj_dbg (self, "couldn't load current networking mode: %s", error->message);
|
||||
g_error_free (error);
|
||||
} else if (!mm_ublox_parse_ubmconf_response (response, &ctx->self->priv->mode, &error)) {
|
||||
mm_dbg ("u-blox: couldn't parse current networking mode response '%s': %s", response, error->message);
|
||||
} else if (!mm_ublox_parse_ubmconf_response (response, &self->priv->mode, &error)) {
|
||||
mm_obj_dbg (self, "couldn't parse current networking mode response '%s': %s", response, error->message);
|
||||
g_error_free (error);
|
||||
} else {
|
||||
g_assert (ctx->self->priv->mode != MM_UBLOX_NETWORKING_MODE_UNKNOWN);
|
||||
mm_dbg ("u-blox: networking mode loaded: %s", mm_ublox_networking_mode_get_string (ctx->self->priv->mode));
|
||||
g_assert (self->priv->mode != MM_UBLOX_NETWORKING_MODE_UNKNOWN);
|
||||
mm_obj_dbg (self, "networking mode loaded: %s", mm_ublox_networking_mode_get_string (self->priv->mode));
|
||||
}
|
||||
|
||||
/* If checking networking mode isn't supported, we'll fallback to
|
||||
* assume the device is in router mode, which is the mode asking for
|
||||
* less connection setup rules from our side (just request DHCP).
|
||||
*/
|
||||
if (ctx->self->priv->mode == MM_UBLOX_NETWORKING_MODE_UNKNOWN && ctx->has_net) {
|
||||
mm_dbg ("u-blox: fallback to default networking mode: router");
|
||||
ctx->self->priv->mode = MM_UBLOX_NETWORKING_MODE_ROUTER;
|
||||
if (self->priv->mode == MM_UBLOX_NETWORKING_MODE_UNKNOWN && ctx->has_net) {
|
||||
mm_obj_dbg (self, "fallback to default networking mode: router");
|
||||
self->priv->mode = MM_UBLOX_NETWORKING_MODE_ROUTER;
|
||||
}
|
||||
|
||||
ctx->self->priv->mode_checked = TRUE;
|
||||
self->priv->mode_checked = TRUE;
|
||||
|
||||
ctx->step++;
|
||||
create_bearer_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
profile_check_ready (MMBaseModem *self,
|
||||
profile_check_ready (MMBaseModem *_self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
CreateBearerContext *ctx;
|
||||
MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
CreateBearerContext *ctx;
|
||||
|
||||
ctx = (CreateBearerContext *) g_task_get_task_data (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (self, res, &error);
|
||||
response = mm_base_modem_at_command_finish (_self, res, &error);
|
||||
if (!response) {
|
||||
mm_dbg ("u-blox: couldn't load current usb profile: %s", error->message);
|
||||
mm_obj_dbg (self, "couldn't load current usb profile: %s", error->message);
|
||||
g_error_free (error);
|
||||
} else if (!mm_ublox_parse_uusbconf_response (response, &ctx->self->priv->profile, &error)) {
|
||||
mm_dbg ("u-blox: couldn't parse current usb profile response '%s': %s", response, error->message);
|
||||
} else if (!mm_ublox_parse_uusbconf_response (response, &self->priv->profile, &error)) {
|
||||
mm_obj_dbg (self, "couldn't parse current usb profile response '%s': %s", response, error->message);
|
||||
g_error_free (error);
|
||||
} else {
|
||||
g_assert (ctx->self->priv->profile != MM_UBLOX_USB_PROFILE_UNKNOWN);
|
||||
mm_dbg ("u-blox: usb profile loaded: %s", mm_ublox_usb_profile_get_string (ctx->self->priv->profile));
|
||||
g_assert (self->priv->profile != MM_UBLOX_USB_PROFILE_UNKNOWN);
|
||||
mm_obj_dbg (self, "usb profile loaded: %s", mm_ublox_usb_profile_get_string (self->priv->profile));
|
||||
}
|
||||
|
||||
/* Assume the operation has been performed, even if it may have failed */
|
||||
ctx->self->priv->profile_checked = TRUE;
|
||||
self->priv->profile_checked = TRUE;
|
||||
|
||||
ctx->step++;
|
||||
create_bearer_step (task);
|
||||
@@ -1641,19 +1637,22 @@ profile_check_ready (MMBaseModem *self,
|
||||
static void
|
||||
create_bearer_step (GTask *task)
|
||||
{
|
||||
CreateBearerContext *ctx;
|
||||
MMBroadbandModemUblox *self;
|
||||
CreateBearerContext *ctx;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
ctx = (CreateBearerContext *) g_task_get_task_data (task);
|
||||
switch (ctx->step) {
|
||||
case CREATE_BEARER_STEP_FIRST:
|
||||
ctx->step++;
|
||||
/* fall through */
|
||||
|
||||
case CREATE_BEARER_STEP_CHECK_PROFILE:
|
||||
if (!ctx->self->priv->profile_checked) {
|
||||
mm_dbg ("u-blox: checking current USB profile...");
|
||||
if (!self->priv->profile_checked) {
|
||||
mm_obj_dbg (self, "checking current USB profile...");
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM (self),
|
||||
"+UUSBCONF?",
|
||||
3,
|
||||
FALSE,
|
||||
@@ -1665,10 +1664,10 @@ create_bearer_step (GTask *task)
|
||||
/* fall through */
|
||||
|
||||
case CREATE_BEARER_STEP_CHECK_MODE:
|
||||
if (!ctx->self->priv->mode_checked) {
|
||||
mm_dbg ("u-blox: checking current networking mode...");
|
||||
if (!self->priv->mode_checked) {
|
||||
mm_obj_dbg (self, "checking current networking mode...");
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM (self),
|
||||
"+UBMCONF?",
|
||||
3,
|
||||
FALSE,
|
||||
@@ -1682,16 +1681,16 @@ create_bearer_step (GTask *task)
|
||||
case CREATE_BEARER_STEP_CREATE_BEARER:
|
||||
/* If we have a net interface, we'll create a u-blox bearer, unless for
|
||||
* any reason we have the back-compatible profile selected. */
|
||||
if ((ctx->self->priv->profile != MM_UBLOX_USB_PROFILE_BACK_COMPATIBLE) && ctx->has_net) {
|
||||
if ((self->priv->profile != MM_UBLOX_USB_PROFILE_BACK_COMPATIBLE) && ctx->has_net) {
|
||||
/* whenever there is a net port, we should have loaded a valid networking mode */
|
||||
g_assert (ctx->self->priv->mode != MM_UBLOX_NETWORKING_MODE_UNKNOWN);
|
||||
mm_dbg ("u-blox: creating u-blox broadband bearer (%s profile, %s mode)...",
|
||||
mm_ublox_usb_profile_get_string (ctx->self->priv->profile),
|
||||
mm_ublox_networking_mode_get_string (ctx->self->priv->mode));
|
||||
g_assert (self->priv->mode != MM_UBLOX_NETWORKING_MODE_UNKNOWN);
|
||||
mm_obj_dbg (self, "creating u-blox broadband bearer (%s profile, %s mode)...",
|
||||
mm_ublox_usb_profile_get_string (self->priv->profile),
|
||||
mm_ublox_networking_mode_get_string (self->priv->mode));
|
||||
mm_broadband_bearer_ublox_new (
|
||||
MM_BROADBAND_MODEM (ctx->self),
|
||||
ctx->self->priv->profile,
|
||||
ctx->self->priv->mode,
|
||||
MM_BROADBAND_MODEM (self),
|
||||
self->priv->profile,
|
||||
self->priv->mode,
|
||||
ctx->properties,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback) broadband_bearer_ublox_new_ready,
|
||||
@@ -1701,8 +1700,8 @@ create_bearer_step (GTask *task)
|
||||
|
||||
/* If usb profile is back-compatible already, or if there is no NET port
|
||||
* available, create default generic bearer */
|
||||
mm_dbg ("u-blox: creating generic broadband bearer...");
|
||||
mm_broadband_bearer_new (MM_BROADBAND_MODEM (ctx->self),
|
||||
mm_obj_dbg (self, "creating generic broadband bearer...");
|
||||
mm_broadband_bearer_new (MM_BROADBAND_MODEM (self),
|
||||
ctx->properties,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback) broadband_bearer_new_ready,
|
||||
@@ -1733,7 +1732,6 @@ modem_create_bearer (MMIfaceModem *self,
|
||||
|
||||
ctx = g_slice_new0 (CreateBearerContext);
|
||||
ctx->step = CREATE_BEARER_STEP_FIRST;
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->properties = g_object_ref (properties);
|
||||
|
||||
/* Flag whether this modem has exposed a network interface */
|
||||
|
@@ -365,6 +365,7 @@ static const MMModemMode ublox_combinations[] = {
|
||||
|
||||
GArray *
|
||||
mm_ublox_parse_urat_test_response (const gchar *response,
|
||||
gpointer log_object,
|
||||
GError **error)
|
||||
{
|
||||
GArray *combinations = NULL;
|
||||
@@ -415,7 +416,7 @@ mm_ublox_parse_urat_test_response (const gchar *response,
|
||||
|
||||
selected_value = g_array_index (selected, guint, i);
|
||||
if (selected_value >= G_N_ELEMENTS (ublox_combinations)) {
|
||||
mm_warn ("Unexpected AcT value: %u", selected_value);
|
||||
mm_obj_warn (log_object, "unexpected AcT value: %u", selected_value);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -435,12 +436,12 @@ mm_ublox_parse_urat_test_response (const gchar *response,
|
||||
|
||||
preferred_value = g_array_index (preferred, guint, j);
|
||||
if (preferred_value >= G_N_ELEMENTS (ublox_combinations)) {
|
||||
mm_warn ("Unexpected AcT preferred value: %u", preferred_value);
|
||||
mm_obj_warn (log_object, "unexpected AcT preferred value: %u", preferred_value);
|
||||
continue;
|
||||
}
|
||||
combination.preferred = ublox_combinations[preferred_value];
|
||||
if (mm_count_bits_set (combination.preferred) != 1) {
|
||||
mm_warn ("AcT preferred value should be a single AcT: %u", preferred_value);
|
||||
mm_obj_warn (log_object, "AcT preferred value should be a single AcT: %u", preferred_value);
|
||||
continue;
|
||||
}
|
||||
if (!(combination.allowed & combination.preferred))
|
||||
@@ -1023,6 +1024,7 @@ mm_ublox_filter_supported_modes (const gchar *model,
|
||||
|
||||
GArray *
|
||||
mm_ublox_get_supported_bands (const gchar *model,
|
||||
gpointer log_object,
|
||||
GError **error)
|
||||
{
|
||||
MMModemMode mode;
|
||||
@@ -1034,13 +1036,13 @@ mm_ublox_get_supported_bands (const gchar *model,
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (band_configuration); i++) {
|
||||
if (g_str_has_prefix (model, band_configuration[i].model)) {
|
||||
mm_dbg("Found Model (Supported Bands): %s", band_configuration[i].model);
|
||||
mm_obj_dbg (log_object, "known supported bands found for model: %s", band_configuration[i].model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == G_N_ELEMENTS (band_configuration)) {
|
||||
mm_warn ("Unknown model name given: %s", model);
|
||||
mm_obj_warn (log_object, "unknown model name given when looking for supported bands: %s", model);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1175,19 +1177,22 @@ static void
|
||||
append_bands (GArray *bands,
|
||||
guint ubandsel_value,
|
||||
MMModemMode mode,
|
||||
const gchar *model)
|
||||
const gchar *model,
|
||||
gpointer log_object)
|
||||
{
|
||||
guint i, j, k, x;
|
||||
MMModemBand band;
|
||||
|
||||
/* Find Modem Model Index in band_configuration */
|
||||
for (i = 0; i < G_N_ELEMENTS (band_configuration); i++) {
|
||||
if (g_str_has_prefix (model, band_configuration[i].model))
|
||||
if (g_str_has_prefix (model, band_configuration[i].model)) {
|
||||
mm_obj_dbg (log_object, "known bands found for model: %s", band_configuration[i].model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == G_N_ELEMENTS (band_configuration)) {
|
||||
mm_warn ("Unknown Modem Model given: %s", model);
|
||||
mm_obj_warn (log_object, "unknown model name given when looking for bands: %s", model);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1242,6 +1247,7 @@ append_bands (GArray *bands,
|
||||
GArray *
|
||||
mm_ublox_parse_ubandsel_response (const gchar *response,
|
||||
const gchar *model,
|
||||
gpointer log_object,
|
||||
GError **error)
|
||||
{
|
||||
GArray *array_values = NULL;
|
||||
@@ -1270,7 +1276,7 @@ mm_ublox_parse_ubandsel_response (const gchar *response,
|
||||
mode = supported_modes_per_model (model);
|
||||
array = g_array_new (FALSE, FALSE, sizeof (MMModemBand));
|
||||
for (i = 0; i < array_values->len; i++)
|
||||
append_bands (array, g_array_index (array_values, guint, i), mode, model);
|
||||
append_bands (array, g_array_index (array_values, guint, i), mode, model, log_object);
|
||||
|
||||
if (!array->len) {
|
||||
inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
@@ -1591,7 +1597,8 @@ mm_ublox_parse_uact_response (const gchar *response,
|
||||
|
||||
static GArray *
|
||||
parse_bands_from_string (const gchar *str,
|
||||
const gchar *group)
|
||||
const gchar *group,
|
||||
gpointer log_object)
|
||||
{
|
||||
GArray *bands = NULL;
|
||||
GError *inner_error = NULL;
|
||||
@@ -1603,12 +1610,12 @@ parse_bands_from_string (const gchar *str,
|
||||
|
||||
bands = uact_num_array_to_band_array (nums);
|
||||
tmpstr = mm_common_build_bands_string ((MMModemBand *)(bands->data), bands->len);
|
||||
mm_dbg ("modem reports support for %s bands: %s", group, tmpstr);
|
||||
mm_obj_dbg (log_object, "modem reports support for %s bands: %s", group, tmpstr);
|
||||
g_free (tmpstr);
|
||||
|
||||
g_array_unref (nums);
|
||||
} else if (inner_error) {
|
||||
mm_warn ("couldn't parse list of supported %s bands: %s", group, inner_error->message);
|
||||
mm_obj_warn (log_object, "couldn't parse list of supported %s bands: %s", group, inner_error->message);
|
||||
g_clear_error (&inner_error);
|
||||
}
|
||||
|
||||
@@ -1617,6 +1624,7 @@ parse_bands_from_string (const gchar *str,
|
||||
|
||||
gboolean
|
||||
mm_ublox_parse_uact_test (const gchar *response,
|
||||
gpointer log_object,
|
||||
GArray **bands2g_out,
|
||||
GArray **bands3g_out,
|
||||
GArray **bands4g_out,
|
||||
@@ -1669,9 +1677,9 @@ mm_ublox_parse_uact_test (const gchar *response,
|
||||
goto out;
|
||||
}
|
||||
|
||||
bands2g = parse_bands_from_string (bands2g_str, "2G");
|
||||
bands3g = parse_bands_from_string (bands3g_str, "3G");
|
||||
bands4g = parse_bands_from_string (bands4g_str, "4G");
|
||||
bands2g = parse_bands_from_string (bands2g_str, "2G", log_object);
|
||||
bands3g = parse_bands_from_string (bands3g_str, "3G", log_object);
|
||||
bands4g = parse_bands_from_string (bands4g_str, "4G", log_object);
|
||||
|
||||
if (!bands2g->len && !bands3g->len && !bands4g->len) {
|
||||
inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
@@ -1745,6 +1753,7 @@ mm_ublox_build_uact_set_command (GArray *bands,
|
||||
|
||||
gboolean
|
||||
mm_ublox_parse_urat_read_response (const gchar *response,
|
||||
gpointer log_object,
|
||||
MMModemMode *out_allowed,
|
||||
MMModemMode *out_preferred,
|
||||
GError **error)
|
||||
@@ -1783,7 +1792,7 @@ mm_ublox_parse_urat_read_response (const gchar *response,
|
||||
}
|
||||
allowed = ublox_combinations[value];
|
||||
allowed_str = mm_modem_mode_build_string_from_mask (allowed);
|
||||
mm_dbg ("current allowed modes retrieved: %s", allowed_str);
|
||||
mm_obj_dbg (log_object, "current allowed modes retrieved: %s", allowed_str);
|
||||
|
||||
/* Preferred item is optional */
|
||||
if (mm_get_uint_from_match_info (match_info, 2, &value)) {
|
||||
@@ -1794,7 +1803,7 @@ mm_ublox_parse_urat_read_response (const gchar *response,
|
||||
}
|
||||
preferred = ublox_combinations[value];
|
||||
preferred_str = mm_modem_mode_build_string_from_mask (preferred);
|
||||
mm_dbg ("current preferred modes retrieved: %s", preferred_str);
|
||||
mm_obj_dbg (log_object, "current preferred modes retrieved: %s", preferred_str);
|
||||
if (mm_count_bits_set (preferred) != 1) {
|
||||
inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"AcT preferred value should be a single AcT: %s", preferred_str);
|
||||
@@ -1884,6 +1893,7 @@ mm_ublox_build_urat_set_command (MMModemMode allowed,
|
||||
|
||||
MMUbloxBearerAllowedAuth
|
||||
mm_ublox_parse_uauthreq_test (const char *response,
|
||||
gpointer log_object,
|
||||
GError **error)
|
||||
{
|
||||
MMUbloxBearerAllowedAuth mask = MM_UBLOX_BEARER_ALLOWED_AUTH_UNKNOWN;
|
||||
@@ -1931,7 +1941,7 @@ mm_ublox_parse_uauthreq_test (const char *response,
|
||||
mask |= MM_UBLOX_BEARER_ALLOWED_AUTH_AUTO;
|
||||
break;
|
||||
default:
|
||||
mm_warn ("Unexpected +UAUTHREQ value: %u", val);
|
||||
mm_obj_warn (log_object, "unexpected +UAUTHREQ value: %u", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -101,6 +101,7 @@ gboolean mm_ublox_parse_cfun_response (const gchar *response,
|
||||
/* URAT=? response parser */
|
||||
|
||||
GArray *mm_ublox_parse_urat_test_response (const gchar *response,
|
||||
gpointer log_object,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -122,6 +123,7 @@ GArray *mm_ublox_filter_supported_modes (const gchar *model,
|
||||
/* Model-based supported bands loading */
|
||||
|
||||
GArray *mm_ublox_get_supported_bands (const gchar *model,
|
||||
gpointer log_object,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -129,6 +131,7 @@ GArray *mm_ublox_get_supported_bands (const gchar *model,
|
||||
|
||||
GArray *mm_ublox_parse_ubandsel_response (const gchar *response,
|
||||
const gchar *model,
|
||||
gpointer log_object,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -148,6 +151,7 @@ GArray *mm_ublox_parse_uact_response (const gchar *response,
|
||||
/* UACT=? test parser */
|
||||
|
||||
gboolean mm_ublox_parse_uact_test (const gchar *response,
|
||||
gpointer log_object,
|
||||
GArray **bands_2g,
|
||||
GArray **bands_3g,
|
||||
GArray **bands_4g,
|
||||
@@ -168,6 +172,7 @@ MMModemMode mm_ublox_get_modem_mode_any (const GArray *combinations);
|
||||
/* URAT? response parser */
|
||||
|
||||
gboolean mm_ublox_parse_urat_read_response (const gchar *response,
|
||||
gpointer log_object,
|
||||
MMModemMode *out_allowed,
|
||||
MMModemMode *out_preferred,
|
||||
GError **error);
|
||||
@@ -191,6 +196,7 @@ typedef enum { /*< underscore_name=mm_ublox_bearer_allowed_auth >*/
|
||||
} MMUbloxBearerAllowedAuth;
|
||||
|
||||
MMUbloxBearerAllowedAuth mm_ublox_parse_uauthreq_test (const char *response,
|
||||
gpointer log_object,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-serial-parsers.h"
|
||||
#include "mm-broadband-modem-ublox.h"
|
||||
#include "mm-plugin-ublox.h"
|
||||
@@ -88,9 +88,7 @@ ready_timeout (GTask *task)
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (ctx->port, ctx->ready_regex,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
mm_dbg ("(%s/%s) timed out waiting for READY unsolicited message",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
mm_obj_dbg (probe, "timed out waiting for READY unsolicited message");
|
||||
|
||||
/* not an error really, we didn't probe anything yet, that's all */
|
||||
g_task_return_boolean (task, TRUE);
|
||||
@@ -113,9 +111,7 @@ ready_received (MMPortSerialAt *port,
|
||||
g_source_remove (ctx->timeout_id);
|
||||
ctx->timeout_id = 0;
|
||||
|
||||
mm_dbg ("(%s/%s) READY received: port is AT",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
mm_obj_dbg (probe, "received READY: port is AT");
|
||||
|
||||
/* Flag as an AT port right away */
|
||||
mm_port_probe_set_result_at (probe, TRUE);
|
||||
@@ -133,9 +129,7 @@ wait_for_ready (GTask *task)
|
||||
ctx = g_task_get_task_data (task);
|
||||
probe = g_task_get_source_object (task);
|
||||
|
||||
mm_dbg ("(%s/%s) waiting for READY unsolicited message...",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
mm_obj_dbg (probe, "waiting for READY unsolicited message...");
|
||||
|
||||
/* Configure a regex on the TTY, so that we stop the custom init
|
||||
* as soon as +READY URC is received */
|
||||
@@ -145,10 +139,7 @@ wait_for_ready (GTask *task)
|
||||
task,
|
||||
NULL);
|
||||
|
||||
mm_dbg ("(%s/%s) waiting %d seconds for init timeout",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe),
|
||||
ctx->wait_timeout_secs);
|
||||
mm_obj_dbg (probe, "waiting %d seconds for init timeout", ctx->wait_timeout_secs);
|
||||
|
||||
/* Otherwise, let the custom init timeout in some seconds. */
|
||||
ctx->timeout_id = g_timeout_add_seconds (ctx->wait_timeout_secs, (GSourceFunc) ready_timeout, task);
|
||||
@@ -160,7 +151,7 @@ quick_at_ready (MMPortSerialAt *port,
|
||||
GTask *task)
|
||||
{
|
||||
MMPortProbe *probe;
|
||||
GError *error = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
probe = g_task_get_source_object (task);
|
||||
|
||||
@@ -169,28 +160,21 @@ quick_at_ready (MMPortSerialAt *port,
|
||||
/* On a timeout error, wait for READY URC */
|
||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
|
||||
wait_for_ready (task);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
/* On an unknown error, make it fatal */
|
||||
if (!mm_serial_parser_v1_is_known_error (error)) {
|
||||
mm_warn ("(%s/%s) custom port initialization logic failed: %s",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe),
|
||||
error->message);
|
||||
goto out_complete;
|
||||
mm_obj_warn (probe, "custom port initialization logic failed: %s", error->message);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
mm_dbg ("(%s/%s) port is AT",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
mm_obj_dbg (probe, "port is AT");
|
||||
mm_port_probe_set_result_at (probe, TRUE);
|
||||
|
||||
out_complete:
|
||||
out:
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
out:
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -290,7 +290,7 @@ compare_combinations (const gchar *response,
|
||||
GError *error = NULL;
|
||||
guint i;
|
||||
|
||||
combinations = mm_ublox_parse_urat_test_response (response, &error);
|
||||
combinations = mm_ublox_parse_urat_test_response (response, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (combinations);
|
||||
|
||||
@@ -461,7 +461,7 @@ test_urat_read_response (void)
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
success = mm_ublox_parse_urat_read_response (urat_tests[i].response,
|
||||
success = mm_ublox_parse_urat_read_response (urat_tests[i].response, NULL,
|
||||
&allowed, &preferred, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (success);
|
||||
@@ -498,7 +498,7 @@ common_validate_ubandsel_response (const gchar *str,
|
||||
GError *error = NULL;
|
||||
GArray *bands;
|
||||
|
||||
bands = mm_ublox_parse_ubandsel_response (str, model, &error);
|
||||
bands = mm_ublox_parse_ubandsel_response (str, model, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (bands);
|
||||
|
||||
@@ -701,7 +701,7 @@ common_validate_uact_test (const gchar *str,
|
||||
GArray *bands_3g = NULL;
|
||||
GArray *bands_4g = NULL;
|
||||
|
||||
result = mm_ublox_parse_uact_test (str, &bands_2g, &bands_3g, &bands_4g, &error);
|
||||
result = mm_ublox_parse_uact_test (str, NULL, &bands_2g, &bands_3g, &bands_4g, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (result);
|
||||
|
||||
@@ -858,7 +858,7 @@ common_validate_uauthreq_test (const gchar *str,
|
||||
GError *error = NULL;
|
||||
MMUbloxBearerAllowedAuth allowed_auths;
|
||||
|
||||
allowed_auths = mm_ublox_parse_uauthreq_test (str, &error);
|
||||
allowed_auths = mm_ublox_parse_uauthreq_test (str, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpuint (allowed_auths, ==, expected_allowed_auths);
|
||||
}
|
||||
|
Reference in New Issue
Block a user