sierra: port to use object logging

This commit is contained in:
Aleksander Morgado
2020-04-07 16:02:25 +02:00
parent aed9f46443
commit d15da9cf60
8 changed files with 41 additions and 44 deletions

View File

@@ -29,7 +29,7 @@
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
#include "mm-broadband-bearer-sierra.h" #include "mm-broadband-bearer-sierra.h"
#include "mm-log.h" #include "mm-log-object.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"
#include "mm-modem-helpers-sierra.h" #include "mm-modem-helpers-sierra.h"
@@ -327,7 +327,7 @@ dial_3gpp_context_step (GTask *task)
allowed_auth = mm_bearer_properties_get_allowed_auth (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)));
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_obj_dbg (self, "not using authentication");
if (self->priv->is_icera) if (self->priv->is_icera)
command = g_strdup_printf ("%%IPDPCFG=%d,0,0,\"\",\"\"", ctx->cid); command = g_strdup_printf ("%%IPDPCFG=%d,0,0,\"\",\"\"", ctx->cid);
else else
@@ -338,13 +338,13 @@ dial_3gpp_context_step (GTask *task)
guint sierra_auth; guint sierra_auth;
if (allowed_auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) { if (allowed_auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) {
mm_dbg ("Using default (PAP) authentication method"); mm_obj_dbg (self, "using default (PAP) authentication method");
sierra_auth = 1; sierra_auth = 1;
} else if (allowed_auth & MM_BEARER_ALLOWED_AUTH_PAP) { } else if (allowed_auth & MM_BEARER_ALLOWED_AUTH_PAP) {
mm_dbg ("Using PAP authentication method"); mm_obj_dbg (self, "using PAP authentication method");
sierra_auth = 1; sierra_auth = 1;
} else if (allowed_auth & MM_BEARER_ALLOWED_AUTH_CHAP) { } else if (allowed_auth & MM_BEARER_ALLOWED_AUTH_CHAP) {
mm_dbg ("Using CHAP authentication method"); mm_obj_dbg (self, "using CHAP authentication method");
sierra_auth = 2; sierra_auth = 2;
} else { } else {
gchar *str; gchar *str;
@@ -479,13 +479,13 @@ disconnect_3gpp_finish (MMBroadbandBearer *self,
static void static void
parent_disconnect_3gpp_ready (MMBroadbandBearer *self, parent_disconnect_3gpp_ready (MMBroadbandBearer *self,
GAsyncResult *res, GAsyncResult *res,
GTask *task) GTask *task)
{ {
GError *error = NULL; GError *error = NULL;
if (!MM_BROADBAND_BEARER_CLASS (mm_broadband_bearer_sierra_parent_class)->disconnect_3gpp_finish (self, res, &error)) { if (!MM_BROADBAND_BEARER_CLASS (mm_broadband_bearer_sierra_parent_class)->disconnect_3gpp_finish (self, res, &error)) {
mm_dbg ("Parent disconnection failed (not fatal): %s", error->message); mm_obj_dbg (self, "parent disconnection failed (not fatal): %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -494,16 +494,19 @@ parent_disconnect_3gpp_ready (MMBroadbandBearer *self,
} }
static void static void
disconnect_scact_ready (MMBaseModem *modem, disconnect_scact_ready (MMBaseModem *modem,
GAsyncResult *res, GAsyncResult *res,
GTask *task) GTask *task)
{ {
GError *error = NULL; MMBroadbandBearerSierra *self;
GError *error = NULL;
self = g_task_get_source_object (task);
/* Ignore errors for now */ /* Ignore errors for now */
mm_base_modem_at_command_full_finish (modem, res, &error); mm_base_modem_at_command_full_finish (modem, res, &error);
if (error) { if (error) {
mm_dbg ("Disconnection failed (not fatal): %s", error->message); mm_obj_dbg (self, "disconnection failed (not fatal): %s", error->message);
g_error_free (error); g_error_free (error);
} }

View File

@@ -27,7 +27,7 @@
#include "mm-broadband-modem-sierra-icera.h" #include "mm-broadband-modem-sierra-icera.h"
#include "mm-iface-modem.h" #include "mm-iface-modem.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"
#include "mm-log.h" #include "mm-log-object.h"
#include "mm-common-sierra.h" #include "mm-common-sierra.h"
#include "mm-broadband-bearer-sierra.h" #include "mm-broadband-bearer-sierra.h"
@@ -74,7 +74,7 @@ modem_create_bearer (MMIfaceModem *self,
task = g_task_new (self, NULL, callback, user_data); task = g_task_new (self, NULL, callback, user_data);
mm_dbg ("Creating Sierra bearer..."); mm_obj_dbg (self, "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 */ TRUE, /* is_icera */

View File

@@ -26,7 +26,7 @@
#include "ModemManager.h" #include "ModemManager.h"
#include "mm-broadband-modem-sierra.h" #include "mm-broadband-modem-sierra.h"
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
#include "mm-log.h" #include "mm-log-object.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"
#include "mm-errors-types.h" #include "mm-errors-types.h"
#include "mm-iface-modem.h" #include "mm-iface-modem.h"
@@ -108,7 +108,6 @@ load_unlock_retries (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
mm_dbg ("loading unlock retries (sierra)...");
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CPINC?", "+CPINC?",
3, 3,
@@ -1004,7 +1003,7 @@ own_numbers_ready (MMBaseModem *self,
/* MDNs are 10 digits in length */ /* MDNs are 10 digits in length */
if (i != 10) { if (i != 10) {
mm_warn ("Failed to parse MDN: expected 10 digits, got %d", i); mm_obj_warn (self, "failed to parse MDN: expected 10 digits, got %d", i);
goto fallback; goto fallback;
} }
@@ -1029,7 +1028,6 @@ modem_load_own_numbers (MMIfaceModem *self,
{ {
GTask *task; GTask *task;
mm_dbg ("loading own numbers (Sierra)...");
task = g_task_new (self, NULL, callback, user_data); task = g_task_new (self, NULL, callback, user_data);
/* 3GPP modems can just run parent's own number loading */ /* 3GPP modems can just run parent's own number loading */
@@ -1091,7 +1089,7 @@ modem_create_bearer (MMIfaceModem *self,
task = g_task_new (self, NULL, callback, user_data); task = g_task_new (self, NULL, callback, user_data);
mm_dbg ("Creating Sierra bearer..."); mm_obj_dbg (self, "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 */ FALSE, /* is_icera */
@@ -1407,7 +1405,7 @@ cdma_automatic_activation_step (GTask *task)
/* fall-through */ /* fall-through */
case CDMA_AUTOMATIC_ACTIVATION_STEP_UNLOCK: case CDMA_AUTOMATIC_ACTIVATION_STEP_UNLOCK:
mm_info ("Activation step [1/4]: unlocking device"); mm_obj_info (self, "activation step [1/4]: unlocking device");
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
"~NAMLCK=000000", "~NAMLCK=000000",
20, 20,
@@ -1419,7 +1417,7 @@ cdma_automatic_activation_step (GTask *task)
case CDMA_AUTOMATIC_ACTIVATION_STEP_CDV: { case CDMA_AUTOMATIC_ACTIVATION_STEP_CDV: {
gchar *command; gchar *command;
mm_info ("Activation step [2/4]: requesting OTASP"); mm_obj_info (self, "activation step [2/4]: requesting OTASP");
command = g_strdup_printf ("+CDV%s", ctx->carrier_code); command = g_strdup_printf ("+CDV%s", ctx->carrier_code);
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
command, command,
@@ -1432,7 +1430,7 @@ cdma_automatic_activation_step (GTask *task)
} }
case CDMA_AUTOMATIC_ACTIVATION_STEP_CHECK: case CDMA_AUTOMATIC_ACTIVATION_STEP_CHECK:
mm_info ("Activation step [3/4]: checking activation info"); mm_obj_info (self, "activation step [3/4]: checking activation info");
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
"~NAMVAL?0", "~NAMVAL?0",
3, 3,
@@ -1442,7 +1440,7 @@ cdma_automatic_activation_step (GTask *task)
return; return;
case CDMA_AUTOMATIC_ACTIVATION_STEP_LAST: case CDMA_AUTOMATIC_ACTIVATION_STEP_LAST:
mm_info ("Activation step [4/4]: activation process finished"); mm_obj_info (self, "activation step [4/4]: activation process finished");
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
g_object_unref (task); g_object_unref (task);
return; return;
@@ -1539,7 +1537,7 @@ cdma_manual_activation_step (GTask *task)
case CDMA_MANUAL_ACTIVATION_STEP_SPC: { case CDMA_MANUAL_ACTIVATION_STEP_SPC: {
gchar *command; gchar *command;
mm_info ("Activation step [1/5]: unlocking device"); mm_obj_info (self, "activation step [1/5]: unlocking device");
command = g_strdup_printf ("~NAMLCK=%s", command = g_strdup_printf ("~NAMLCK=%s",
mm_cdma_manual_activation_properties_get_spc (ctx->properties)); mm_cdma_manual_activation_properties_get_spc (ctx->properties));
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
@@ -1555,7 +1553,7 @@ cdma_manual_activation_step (GTask *task)
case CDMA_MANUAL_ACTIVATION_STEP_MDN_MIN: { case CDMA_MANUAL_ACTIVATION_STEP_MDN_MIN: {
gchar *command; gchar *command;
mm_info ("Activation step [2/5]: setting MDN/MIN/SID"); mm_obj_info (self, "activation step [2/5]: setting MDN/MIN/SID");
command = g_strdup_printf ("~NAMVAL=0,%s,%s,%" G_GUINT16_FORMAT ",65535", command = g_strdup_printf ("~NAMVAL=0,%s,%s,%" G_GUINT16_FORMAT ",65535",
mm_cdma_manual_activation_properties_get_mdn (ctx->properties), mm_cdma_manual_activation_properties_get_mdn (ctx->properties),
mm_cdma_manual_activation_properties_get_min (ctx->properties), mm_cdma_manual_activation_properties_get_min (ctx->properties),
@@ -1571,7 +1569,7 @@ cdma_manual_activation_step (GTask *task)
} }
case CDMA_MANUAL_ACTIVATION_STEP_OTASP: case CDMA_MANUAL_ACTIVATION_STEP_OTASP:
mm_info ("Activation step [3/5]: requesting OTASP"); mm_obj_info (self, "activation step [3/5]: requesting OTASP");
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
"!IOTASTART", "!IOTASTART",
20, 20,
@@ -1581,7 +1579,7 @@ cdma_manual_activation_step (GTask *task)
return; return;
case CDMA_MANUAL_ACTIVATION_STEP_CHECK: case CDMA_MANUAL_ACTIVATION_STEP_CHECK:
mm_info ("Activation step [4/5]: checking activation info"); mm_obj_info (self, "activation step [4/5]: checking activation info");
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
"~NAMVAL?0", "~NAMVAL?0",
20, 20,
@@ -1591,7 +1589,7 @@ cdma_manual_activation_step (GTask *task)
return; return;
case CDMA_MANUAL_ACTIVATION_STEP_LAST: case CDMA_MANUAL_ACTIVATION_STEP_LAST:
mm_info ("Activation step [5/5]: activation process finished"); mm_obj_info (self, "activation step [5/5]: activation process finished");
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
g_object_unref (task); g_object_unref (task);
return; return;

View File

@@ -160,7 +160,7 @@ gcap_ready (MMPortSerialAt *port,
* on the APP1 port or not. * on the APP1 port or not.
*/ */
if (getenv ("MM_SIERRA_APP1_PPP_OK")) { if (getenv ("MM_SIERRA_APP1_PPP_OK")) {
mm_dbg ("Sierra: APP1 PPP OK '%s'", response); mm_obj_dbg (probe, "(Sierra) APP1 PPP OK '%s'", response);
g_object_set_data (G_OBJECT (probe), TAG_SIERRA_APP1_PPP_OK, GUINT_TO_POINTER (TRUE)); g_object_set_data (G_OBJECT (probe), TAG_SIERRA_APP1_PPP_OK, GUINT_TO_POINTER (TRUE));
} }
} else if (strstr (response, "APP2") || } else if (strstr (response, "APP2") ||
@@ -183,24 +183,24 @@ out:
static void static void
sierra_custom_init_step (GTask *task) sierra_custom_init_step (GTask *task)
{ {
MMPortProbe *probe;
SierraCustomInitContext *ctx; SierraCustomInitContext *ctx;
GCancellable *cancellable; GCancellable *cancellable;
ctx = g_task_get_task_data (task); probe = g_task_get_source_object (task);
ctx = g_task_get_task_data (task);
cancellable = g_task_get_cancellable (task); cancellable = g_task_get_cancellable (task);
/* If cancelled, end */ /* If cancelled, end */
if (g_cancellable_is_cancelled (cancellable)) { if (g_cancellable_is_cancelled (cancellable)) {
mm_dbg ("(Sierra) no need to keep on running custom init in '%s'", mm_obj_dbg (probe, "(Sierra) no need to keep on running custom init");
mm_port_get_device (MM_PORT (ctx->port)));
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
g_object_unref (task); g_object_unref (task);
return; return;
} }
if (ctx->retries == 0) { if (ctx->retries == 0) {
mm_dbg ("(Sierra) Couldn't get port type hints from '%s'", mm_obj_dbg (probe, "(Sierra) couldn't get port type hints");
mm_port_get_device (MM_PORT (ctx->port)));
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
g_object_unref (task); g_object_unref (task);
return; return;
@@ -328,8 +328,8 @@ mm_common_sierra_modem_power_up (MMIfaceModem *self,
return; return;
} }
mm_warn ("Not in full functionality status, power-up command is needed. " mm_obj_warn (self, "not in full functionality status, power-up command is needed");
"Note that it may reboot the modem."); mm_obj_warn (self, "device may be rebooted");
/* Try to go to full functionality mode without rebooting the system. /* Try to go to full functionality mode without rebooting the system.
* Works well if we previously switched off the power with CFUN=4 * Works well if we previously switched off the power with CFUN=4

View File

@@ -16,7 +16,6 @@
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include "mm-log.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"
#include "mm-modem-helpers-sierra.h" #include "mm-modem-helpers-sierra.h"

View File

@@ -22,7 +22,6 @@
#define _LIBMM_INSIDE_MM #define _LIBMM_INSIDE_MM
#include <libmm-glib.h> #include <libmm-glib.h>
#include "mm-log.h"
#include "mm-plugin-sierra-legacy.h" #include "mm-plugin-sierra-legacy.h"
#include "mm-common-sierra.h" #include "mm-common-sierra.h"
#include "mm-broadband-modem-sierra.h" #include "mm-broadband-modem-sierra.h"

View File

@@ -22,7 +22,7 @@
#define _LIBMM_INSIDE_MM #define _LIBMM_INSIDE_MM
#include <libmm-glib.h> #include <libmm-glib.h>
#include "mm-log.h" #include "mm-log-object.h"
#include "mm-plugin-sierra.h" #include "mm-plugin-sierra.h"
#include "mm-broadband-modem.h" #include "mm-broadband-modem.h"
@@ -52,7 +52,7 @@ create_modem (MMPlugin *self,
{ {
#if defined WITH_QMI #if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) { if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Sierra modem found..."); mm_obj_dbg (self, "QMI-powered Sierra modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid, return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers, drivers,
mm_plugin_get_name (self), mm_plugin_get_name (self),
@@ -63,7 +63,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM #if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) { if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered Sierra modem found..."); mm_obj_dbg (self, "MBIM-powered Sierra modem found...");
return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid, return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers, drivers,
mm_plugin_get_name (self), mm_plugin_get_name (self),

View File

@@ -25,7 +25,6 @@
#include <ModemManager.h> #include <ModemManager.h>
#define _LIBMM_INSIDE_MM #define _LIBMM_INSIDE_MM
#include <libmm-glib.h> #include <libmm-glib.h>
#include "mm-log.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
@@ -96,7 +95,6 @@ load_sim_identifier (MMBaseSim *self,
task = g_task_new (self, NULL, callback, user_data); task = g_task_new (self, NULL, callback, user_data);
mm_dbg ("loading (Sierra) SIM identifier...");
mm_base_modem_at_command ( mm_base_modem_at_command (
modem, modem,
"!ICCID?", "!ICCID?",