aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/mbm/mm-broadband-bearer-mbm.c40
-rw-r--r--plugins/mbm/mm-broadband-modem-mbm.c19
-rw-r--r--plugins/mbm/mm-modem-helpers-mbm.c25
-rw-r--r--plugins/mbm/mm-modem-helpers-mbm.h7
-rw-r--r--plugins/mbm/mm-plugin-mbm.c4
-rw-r--r--plugins/mbm/mm-sim-mbm.c8
-rw-r--r--plugins/mbm/tests/test-modem-helpers-mbm.c2
7 files changed, 50 insertions, 55 deletions
diff --git a/plugins/mbm/mm-broadband-bearer-mbm.c b/plugins/mbm/mm-broadband-bearer-mbm.c
index c4795aa1..761ad86a 100644
--- a/plugins/mbm/mm-broadband-bearer-mbm.c
+++ b/plugins/mbm/mm-broadband-bearer-mbm.c
@@ -38,7 +38,7 @@
#include "mm-base-modem-at.h"
#include "mm-broadband-bearer-mbm.h"
-#include "mm-log.h"
+#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-modem-helpers-mbm.h"
#include "mm-daemon-enums-types.h"
@@ -180,11 +180,10 @@ connect_poll_ready (MMBaseModem *modem,
const gchar *response;
guint state;
- task = self->priv->connect_pending;
- self->priv->connect_pending = NULL;
+ task = g_steal_pointer (&self->priv->connect_pending);
if (!task) {
- mm_dbg ("Connection context was finished already by an unsolicited message");
+ mm_obj_dbg (self, "connection context was finished already by an unsolicited message");
/* Run _finish() to finalize the async call, even if we don't care
* the result */
mm_base_modem_at_command_full_finish (modem, res, NULL);
@@ -219,8 +218,7 @@ connect_poll_cb (MMBroadbandBearerMbm *self)
GTask *task;
Dial3gppContext *ctx;
- task = self->priv->connect_pending;
- self->priv->connect_pending = NULL;
+ task = g_steal_pointer (&self->priv->connect_pending);
g_assert (task);
ctx = g_task_get_task_data (task);
@@ -269,11 +267,10 @@ activate_ready (MMBaseModem *modem,
/* Try to recover the connection context. If none found, it means the
* context was already completed and we have nothing else to do. */
- task = self->priv->connect_pending;
- self->priv->connect_pending = NULL;
+ task = g_steal_pointer (&self->priv->connect_pending);
if (!task) {
- mm_dbg ("Connection context was finished already by an unsolicited message");
+ mm_obj_dbg (self, "connection context was finished already by an unsolicited message");
/* Run _finish() to finalize the async call, even if we don't care
* the result */
mm_base_modem_at_command_full_finish (modem, res, NULL);
@@ -391,7 +388,7 @@ authenticate (GTask *task)
return;
}
- mm_dbg ("Authentication not needed");
+ mm_obj_dbg (self, "authentication not needed");
activate (task);
}
@@ -602,11 +599,8 @@ process_pending_disconnect_attempt (MMBroadbandBearerMbm *self,
DisconnectContext *ctx;
/* Recover disconnection task */
- task = self->priv->disconnect_pending;
- self->priv->disconnect_pending = NULL;
- g_assert (task != NULL);
-
- ctx = g_task_get_task_data (task);
+ task = g_steal_pointer (&self->priv->disconnect_pending);
+ ctx = g_task_get_task_data (task);
if (ctx->poll_id) {
g_source_remove (ctx->poll_id);
@@ -615,7 +609,7 @@ process_pending_disconnect_attempt (MMBroadbandBearerMbm *self,
/* Received 'DISCONNECTED' during a disconnection attempt? */
if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) {
- mm_dbg ("Connection disconnect indicated by an unsolicited message");
+ mm_obj_dbg (self, "connection disconnect indicated by an unsolicited message");
g_task_return_boolean (task, TRUE);
} else {
/* Otherwise, report error */
@@ -638,11 +632,10 @@ disconnect_poll_ready (MMBaseModem *modem,
const gchar *response;
guint state;
- task = self->priv->disconnect_pending;
- self->priv->disconnect_pending = NULL;
+ task = g_steal_pointer (&self->priv->disconnect_pending);
if (!task) {
- mm_dbg ("Disconnection context was finished already by an unsolicited message");
+ mm_obj_dbg (self, "disconnection context was finished already by an unsolicited message");
/* Run _finish() to finalize the async call, even if we don't care
* the result */
mm_base_modem_at_command_full_finish (modem, res, NULL);
@@ -722,8 +715,7 @@ disconnect_enap_ready (MMBaseModem *modem,
GTask *task;
GError *error = NULL;
- task = self->priv->disconnect_pending;
- self->priv->disconnect_pending = NULL;
+ task = g_steal_pointer (&self->priv->disconnect_pending);
/* Try to recover the disconnection context. If none found, it means the
* context was already completed and we have nothing else to do. */
@@ -737,7 +729,7 @@ disconnect_enap_ready (MMBaseModem *modem,
/* 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);
}
@@ -815,8 +807,8 @@ report_connection_status (MMBaseBearer *_self,
return;
}
- mm_dbg ("Received spontaneous E2NAP (%s)",
- mm_bearer_connection_status_get_string (status));
+ mm_obj_dbg (self, "received spontaneous E2NAP (%s)",
+ mm_bearer_connection_status_get_string (status));
/* Received a random 'DISCONNECTED'...*/
if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED ||
diff --git a/plugins/mbm/mm-broadband-modem-mbm.c b/plugins/mbm/mm-broadband-modem-mbm.c
index a4b89fd4..49f94213 100644
--- a/plugins/mbm/mm-broadband-modem-mbm.c
+++ b/plugins/mbm/mm-broadband-modem-mbm.c
@@ -31,7 +31,7 @@
#include <ctype.h>
#include "ModemManager.h"
-#include "mm-log.h"
+#include "mm-log-object.h"
#include "mm-bearer-list.h"
#include "mm-errors-types.h"
#include "mm-modem-helpers.h"
@@ -115,7 +115,7 @@ modem_create_bearer (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- mm_dbg ("Creating MBM bearer...");
+ mm_obj_dbg (self, "creating MBM bearer...");
mm_broadband_bearer_mbm_new (MM_BROADBAND_MODEM_MBM (self),
properties,
NULL, /* cancellable */
@@ -196,7 +196,7 @@ load_supported_modes_finish (MMIfaceModem *_self,
if (!response)
return FALSE;
- if (!mm_mbm_parse_cfun_test (response, &mask, error))
+ if (!mm_mbm_parse_cfun_test (response, self, &mask, error))
return FALSE;
/* Build list of combinations */
@@ -448,7 +448,7 @@ emrdy_ready (MMBaseModem *self,
if (g_error_matches (error,
MM_SERIAL_ERROR,
MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
- mm_warn ("timed out waiting for EMRDY response.");
+ mm_obj_warn (self, "timed out waiting for EMRDY response");
else
MM_BROADBAND_MODEM_MBM (self)->priv->have_emrdy = TRUE;
g_error_free (error);
@@ -635,7 +635,7 @@ factory_reset (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- mm_dbg ("Ignoring factory reset code: '%s'", code);
+ mm_obj_dbg (self, "ignoring user-provided factory reset code: '%s'", code);
mm_base_modem_at_sequence (MM_BASE_MODEM (self),
factory_reset_sequence,
@@ -695,7 +695,6 @@ load_unlock_retries (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- mm_dbg ("loading unlock retries (mbm)...");
mm_base_modem_at_command (MM_BASE_MODEM (self),
"*EPIN?",
10,
@@ -734,19 +733,19 @@ e2nap_received (MMPortSerialAt *port,
switch (state) {
case MBM_E2NAP_DISCONNECTED:
- mm_dbg ("disconnected");
+ mm_obj_dbg (self, "disconnected");
ctx.status = MM_BEARER_CONNECTION_STATUS_DISCONNECTED;
break;
case MBM_E2NAP_CONNECTED:
- mm_dbg ("connected");
+ mm_obj_dbg (self, "connected");
ctx.status = MM_BEARER_CONNECTION_STATUS_CONNECTED;
break;
case MBM_E2NAP_CONNECTING:
- mm_dbg ("connecting");
+ mm_obj_dbg (self, "connecting");
break;
default:
/* Should not happen */
- mm_dbg ("unhandled E2NAP state %d", state);
+ mm_obj_dbg (self, "unhandled E2NAP state %d", state);
}
/* If unknown status, don't try to report anything */
diff --git a/plugins/mbm/mm-modem-helpers-mbm.c b/plugins/mbm/mm-modem-helpers-mbm.c
index 18656e57..31fbb376 100644
--- a/plugins/mbm/mm-modem-helpers-mbm.c
+++ b/plugins/mbm/mm-modem-helpers-mbm.c
@@ -169,21 +169,22 @@ done:
#define CFUN_TAG "+CFUN:"
static void
-add_supported_mode (guint32 *mask,
- guint mode)
+add_supported_mode (guint mode,
+ gpointer log_object,
+ guint32 *mask)
{
g_assert (mask);
-
if (mode >= 32)
- mm_warn ("Ignored unexpected mode in +CFUN match: %d", mode);
+ mm_obj_warn (log_object, "ignored unexpected mode in +CFUN match: %d", mode);
else
*mask |= (1 << mode);
}
gboolean
mm_mbm_parse_cfun_test (const gchar *response,
- guint32 *supported_mask,
- GError **error)
+ gpointer log_object,
+ guint32 *supported_mask,
+ GError **error)
{
gchar **groups;
guint32 mask = 0;
@@ -236,20 +237,20 @@ mm_mbm_parse_cfun_test (const gchar *response,
last_str = separator + 1;
if (!mm_get_uint_from_str (first_str, &first))
- mm_warn ("Couldn't match range start: '%s'", first_str);
+ mm_obj_warn (log_object, "couldn't match range start: '%s'", first_str);
else if (!mm_get_uint_from_str (last_str, &last))
- mm_warn ("Couldn't match range stop: '%s'", last_str);
+ mm_obj_warn (log_object, "couldn't match range stop: '%s'", last_str);
else if (first >= last)
- mm_warn ("Couldn't match range: wrong first '%s' and last '%s' items", first_str, last_str);
+ mm_obj_warn (log_object, "couldn't match range: wrong first '%s' and last '%s' items", first_str, last_str);
else {
for (mode = first; mode <= last; mode++)
- add_supported_mode (&mask, mode);
+ add_supported_mode (mode, log_object, &mask);
}
} else {
if (!mm_get_uint_from_str (supported_modes[i], &mode))
- mm_warn ("Couldn't match mode: '%s'", supported_modes[i]);
+ mm_obj_warn (log_object, "couldn't match mode: '%s'", supported_modes[i]);
else
- add_supported_mode (&mask, mode);
+ add_supported_mode (mode, log_object, &mask);
}
}
diff --git a/plugins/mbm/mm-modem-helpers-mbm.h b/plugins/mbm/mm-modem-helpers-mbm.h
index a7df1b00..3e3bf57a 100644
--- a/plugins/mbm/mm-modem-helpers-mbm.h
+++ b/plugins/mbm/mm-modem-helpers-mbm.h
@@ -34,9 +34,10 @@ typedef enum {
/* AT+CFUN=? test parser
* Returns a bitmask, bit index set for the supported modes reported */
-gboolean mm_mbm_parse_cfun_test (const gchar *response,
- guint32 *supported_mask,
- GError **error);
+gboolean mm_mbm_parse_cfun_test (const gchar *response,
+ gpointer log_object,
+ guint32 *supported_mask,
+ GError **error);
/* AT+CFUN? response parsers */
gboolean mm_mbm_parse_cfun_query_power_state (const gchar *response,
diff --git a/plugins/mbm/mm-plugin-mbm.c b/plugins/mbm/mm-plugin-mbm.c
index 4f3b52a3..b27cbf64 100644
--- a/plugins/mbm/mm-plugin-mbm.c
+++ b/plugins/mbm/mm-plugin-mbm.c
@@ -23,7 +23,7 @@
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
-#include "mm-log.h"
+#include "mm-log-object.h"
#include "mm-plugin-mbm.h"
#include "mm-broadband-modem-mbm.h"
@@ -49,7 +49,7 @@ create_modem (MMPlugin *self,
{
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
- mm_dbg ("MBIM-powered Ericsson modem found...");
+ mm_obj_dbg (self, "MBIM-powered Ericsson modem found...");
return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
diff --git a/plugins/mbm/mm-sim-mbm.c b/plugins/mbm/mm-sim-mbm.c
index f3218705..1b160d6c 100644
--- a/plugins/mbm/mm-sim-mbm.c
+++ b/plugins/mbm/mm-sim-mbm.c
@@ -24,7 +24,7 @@
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
-#include "mm-log.h"
+#include "mm-log-object.h"
#include "mm-base-modem-at.h"
#include "mm-sim-mbm.h"
@@ -93,9 +93,11 @@ cpin_query_cb (GTask *task)
static void
wait_for_unlocked_status (GTask *task)
{
+ MMSimMbm *self;
SendPinPukContext *ctx;
- ctx = g_task_get_task_data (task);
+ self = g_task_get_source_object (task);
+ ctx = g_task_get_task_data (task);
/* Oops... :/ */
if (ctx->retries == 0) {
@@ -109,7 +111,7 @@ wait_for_unlocked_status (GTask *task)
/* Check status */
ctx->retries--;
- mm_dbg ("Scheduling lock state check...");
+ mm_obj_dbg (self, "scheduling lock state check...");
g_timeout_add_seconds (1, (GSourceFunc)cpin_query_cb, task);
}
diff --git a/plugins/mbm/tests/test-modem-helpers-mbm.c b/plugins/mbm/tests/test-modem-helpers-mbm.c
index e64b25c2..da33522c 100644
--- a/plugins/mbm/tests/test-modem-helpers-mbm.c
+++ b/plugins/mbm/tests/test-modem-helpers-mbm.c
@@ -179,7 +179,7 @@ test_cfun_test (void)
gboolean success;
GError *error = NULL;
- success = mm_mbm_parse_cfun_test (cfun_tests[i].str, &mask, &error);
+ success = mm_mbm_parse_cfun_test (cfun_tests[i].str, NULL, &mask, &error);
g_assert_no_error (error);
g_assert (success);
g_assert_cmpuint (mask, ==, cfun_tests[i].expected_mask);