diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-04-07 16:02:25 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-04-08 16:35:10 +0200 |
commit | d15da9cf60af9cd1a6b7036519ec557712b5dbad (patch) | |
tree | 175e321af1227b54354f1f20082ff8014a7e1bdd | |
parent | aed9f46443fe8e195785e54e4f12522520ee3c19 (diff) |
sierra: port to use object logging
-rw-r--r-- | plugins/sierra/mm-broadband-bearer-sierra.c | 27 | ||||
-rw-r--r-- | plugins/sierra/mm-broadband-modem-sierra-icera.c | 4 | ||||
-rw-r--r-- | plugins/sierra/mm-broadband-modem-sierra.c | 26 | ||||
-rw-r--r-- | plugins/sierra/mm-common-sierra.c | 18 | ||||
-rw-r--r-- | plugins/sierra/mm-modem-helpers-sierra.c | 1 | ||||
-rw-r--r-- | plugins/sierra/mm-plugin-sierra-legacy.c | 1 | ||||
-rw-r--r-- | plugins/sierra/mm-plugin-sierra.c | 6 | ||||
-rw-r--r-- | plugins/sierra/mm-sim-sierra.c | 2 |
8 files changed, 41 insertions, 44 deletions
diff --git a/plugins/sierra/mm-broadband-bearer-sierra.c b/plugins/sierra/mm-broadband-bearer-sierra.c index cdfd63ee..24bde739 100644 --- a/plugins/sierra/mm-broadband-bearer-sierra.c +++ b/plugins/sierra/mm-broadband-bearer-sierra.c @@ -29,7 +29,7 @@ #include "mm-base-modem-at.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-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))); 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) command = g_strdup_printf ("%%IPDPCFG=%d,0,0,\"\",\"\"", ctx->cid); else @@ -338,13 +338,13 @@ dial_3gpp_context_step (GTask *task) guint sierra_auth; 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; } 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; } 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; } else { gchar *str; @@ -479,13 +479,13 @@ disconnect_3gpp_finish (MMBroadbandBearer *self, static void parent_disconnect_3gpp_ready (MMBroadbandBearer *self, - GAsyncResult *res, - GTask *task) + GAsyncResult *res, + GTask *task) { GError *error = NULL; 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); } @@ -494,16 +494,19 @@ parent_disconnect_3gpp_ready (MMBroadbandBearer *self, } static void -disconnect_scact_ready (MMBaseModem *modem, +disconnect_scact_ready (MMBaseModem *modem, 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 */ mm_base_modem_at_command_full_finish (modem, res, &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); } diff --git a/plugins/sierra/mm-broadband-modem-sierra-icera.c b/plugins/sierra/mm-broadband-modem-sierra-icera.c index 5749f55b..796260d9 100644 --- a/plugins/sierra/mm-broadband-modem-sierra-icera.c +++ b/plugins/sierra/mm-broadband-modem-sierra-icera.c @@ -27,7 +27,7 @@ #include "mm-broadband-modem-sierra-icera.h" #include "mm-iface-modem.h" #include "mm-modem-helpers.h" -#include "mm-log.h" +#include "mm-log-object.h" #include "mm-common-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); - mm_dbg ("Creating Sierra bearer..."); + mm_obj_dbg (self, "creating sierra bearer..."); mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self), properties, TRUE, /* is_icera */ diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c index 80db350f..c08aec48 100644 --- a/plugins/sierra/mm-broadband-modem-sierra.c +++ b/plugins/sierra/mm-broadband-modem-sierra.c @@ -26,7 +26,7 @@ #include "ModemManager.h" #include "mm-broadband-modem-sierra.h" #include "mm-base-modem-at.h" -#include "mm-log.h" +#include "mm-log-object.h" #include "mm-modem-helpers.h" #include "mm-errors-types.h" #include "mm-iface-modem.h" @@ -108,7 +108,6 @@ load_unlock_retries (MMIfaceModem *self, GAsyncReadyCallback callback, gpointer user_data) { - mm_dbg ("loading unlock retries (sierra)..."); mm_base_modem_at_command (MM_BASE_MODEM (self), "+CPINC?", 3, @@ -1004,7 +1003,7 @@ own_numbers_ready (MMBaseModem *self, /* MDNs are 10 digits in length */ 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; } @@ -1029,7 +1028,6 @@ modem_load_own_numbers (MMIfaceModem *self, { GTask *task; - mm_dbg ("loading own numbers (Sierra)..."); task = g_task_new (self, NULL, callback, user_data); /* 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); - mm_dbg ("Creating Sierra bearer..."); + mm_obj_dbg (self, "creating Sierra bearer..."); mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM (self), properties, FALSE, /* is_icera */ @@ -1407,7 +1405,7 @@ cdma_automatic_activation_step (GTask *task) /* fall-through */ 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), "~NAMLCK=000000", 20, @@ -1419,7 +1417,7 @@ cdma_automatic_activation_step (GTask *task) case CDMA_AUTOMATIC_ACTIVATION_STEP_CDV: { 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); mm_base_modem_at_command (MM_BASE_MODEM (self), command, @@ -1432,7 +1430,7 @@ cdma_automatic_activation_step (GTask *task) } 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), "~NAMVAL?0", 3, @@ -1442,7 +1440,7 @@ cdma_automatic_activation_step (GTask *task) return; 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_object_unref (task); return; @@ -1539,7 +1537,7 @@ cdma_manual_activation_step (GTask *task) case CDMA_MANUAL_ACTIVATION_STEP_SPC: { 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", mm_cdma_manual_activation_properties_get_spc (ctx->properties)); 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: { 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", mm_cdma_manual_activation_properties_get_mdn (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: - 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), "!IOTASTART", 20, @@ -1581,7 +1579,7 @@ cdma_manual_activation_step (GTask *task) return; 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), "~NAMVAL?0", 20, @@ -1591,7 +1589,7 @@ cdma_manual_activation_step (GTask *task) return; 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_object_unref (task); return; diff --git a/plugins/sierra/mm-common-sierra.c b/plugins/sierra/mm-common-sierra.c index 1f14eb03..8a89a166 100644 --- a/plugins/sierra/mm-common-sierra.c +++ b/plugins/sierra/mm-common-sierra.c @@ -160,7 +160,7 @@ gcap_ready (MMPortSerialAt *port, * on the APP1 port or not. */ 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)); } } else if (strstr (response, "APP2") || @@ -183,24 +183,24 @@ out: static void sierra_custom_init_step (GTask *task) { + MMPortProbe *probe; 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); /* If cancelled, end */ if (g_cancellable_is_cancelled (cancellable)) { - mm_dbg ("(Sierra) no need to keep on running custom init in '%s'", - mm_port_get_device (MM_PORT (ctx->port))); + mm_obj_dbg (probe, "(Sierra) no need to keep on running custom init"); g_task_return_boolean (task, TRUE); g_object_unref (task); return; } if (ctx->retries == 0) { - mm_dbg ("(Sierra) Couldn't get port type hints from '%s'", - mm_port_get_device (MM_PORT (ctx->port))); + mm_obj_dbg (probe, "(Sierra) couldn't get port type hints"); g_task_return_boolean (task, TRUE); g_object_unref (task); return; @@ -328,8 +328,8 @@ mm_common_sierra_modem_power_up (MMIfaceModem *self, return; } - mm_warn ("Not in full functionality status, power-up command is needed. " - "Note that it may reboot the modem."); + mm_obj_warn (self, "not in full functionality status, power-up command is needed"); + mm_obj_warn (self, "device may be rebooted"); /* Try to go to full functionality mode without rebooting the system. * Works well if we previously switched off the power with CFUN=4 diff --git a/plugins/sierra/mm-modem-helpers-sierra.c b/plugins/sierra/mm-modem-helpers-sierra.c index 2d5fd7da..ac07c9ee 100644 --- a/plugins/sierra/mm-modem-helpers-sierra.c +++ b/plugins/sierra/mm-modem-helpers-sierra.c @@ -16,7 +16,6 @@ #include <glib.h> #include <string.h> -#include "mm-log.h" #include "mm-modem-helpers.h" #include "mm-modem-helpers-sierra.h" diff --git a/plugins/sierra/mm-plugin-sierra-legacy.c b/plugins/sierra/mm-plugin-sierra-legacy.c index 47bdf113..d7d7a03e 100644 --- a/plugins/sierra/mm-plugin-sierra-legacy.c +++ b/plugins/sierra/mm-plugin-sierra-legacy.c @@ -22,7 +22,6 @@ #define _LIBMM_INSIDE_MM #include <libmm-glib.h> -#include "mm-log.h" #include "mm-plugin-sierra-legacy.h" #include "mm-common-sierra.h" #include "mm-broadband-modem-sierra.h" diff --git a/plugins/sierra/mm-plugin-sierra.c b/plugins/sierra/mm-plugin-sierra.c index 03a06bd8..99871a4a 100644 --- a/plugins/sierra/mm-plugin-sierra.c +++ b/plugins/sierra/mm-plugin-sierra.c @@ -22,7 +22,7 @@ #define _LIBMM_INSIDE_MM #include <libmm-glib.h> -#include "mm-log.h" +#include "mm-log-object.h" #include "mm-plugin-sierra.h" #include "mm-broadband-modem.h" @@ -52,7 +52,7 @@ create_modem (MMPlugin *self, { #if defined WITH_QMI 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, drivers, mm_plugin_get_name (self), @@ -63,7 +63,7 @@ create_modem (MMPlugin *self, #if defined WITH_MBIM 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, drivers, mm_plugin_get_name (self), diff --git a/plugins/sierra/mm-sim-sierra.c b/plugins/sierra/mm-sim-sierra.c index 233bf2f5..d81e82b2 100644 --- a/plugins/sierra/mm-sim-sierra.c +++ b/plugins/sierra/mm-sim-sierra.c @@ -25,7 +25,6 @@ #include <ModemManager.h> #define _LIBMM_INSIDE_MM #include <libmm-glib.h> -#include "mm-log.h" #include "mm-modem-helpers.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); - mm_dbg ("loading (Sierra) SIM identifier..."); mm_base_modem_at_command ( modem, "!ICCID?", |