simtech: port to use object logging

This commit is contained in:
Aleksander Morgado
2020-04-07 16:08:57 +02:00
parent d15da9cf60
commit 9dbc346f93
5 changed files with 39 additions and 43 deletions

View File

@@ -22,7 +22,6 @@
#include <ctype.h> #include <ctype.h>
#include "ModemManager.h" #include "ModemManager.h"
#include "mm-log.h"
#include "mm-errors-types.h" #include "mm-errors-types.h"
#include "mm-iface-modem-location.h" #include "mm-iface-modem-location.h"
#include "mm-iface-modem-voice.h" #include "mm-iface-modem-voice.h"

View File

@@ -28,7 +28,7 @@
#include "ModemManager.h" #include "ModemManager.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"
#include "mm-log.h" #include "mm-log-object.h"
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
#include "mm-iface-modem.h" #include "mm-iface-modem.h"
#include "mm-iface-modem-3gpp.h" #include "mm-iface-modem-3gpp.h"
@@ -261,7 +261,7 @@ autocsq_set_enabled_ready (MMBaseModem *self,
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_base_modem_at_command_finish (self, res, &error)) { if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_dbg ("Couldn't enable automatic signal quality reporting: %s", error->message); mm_obj_dbg (self, "couldn't enable automatic signal quality reporting: %s", error->message);
g_error_free (error); g_error_free (error);
} else } else
csq_urcs_enabled = TRUE; csq_urcs_enabled = TRUE;
@@ -309,7 +309,7 @@ cnsmod_set_enabled_ready (MMBaseModem *self,
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_base_modem_at_command_finish (self, res, &error)) { if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_dbg ("Couldn't enable automatic access technology reporting: %s", error->message); mm_obj_dbg (self, "couldn't enable automatic access technology reporting: %s", error->message);
g_error_free (error); g_error_free (error);
} else } else
cnsmod_urcs_enabled = TRUE; cnsmod_urcs_enabled = TRUE;
@@ -525,7 +525,7 @@ cnsmod_set_disabled_ready (MMBaseModem *self,
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_base_modem_at_command_finish (self, res, &error)) { if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_dbg ("Couldn't disable automatic access technology reporting: %s", error->message); mm_obj_dbg (self, "couldn't disable automatic access technology reporting: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -545,7 +545,7 @@ autocsq_set_disabled_ready (MMBaseModem *self,
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_base_modem_at_command_finish (self, res, &error)) { if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_dbg ("Couldn't disable automatic signal quality reporting: %s", error->message); mm_obj_dbg (self, "couldn't disable automatic signal quality reporting: %s", error->message);
g_error_free (error); g_error_free (error);
} }

View File

@@ -21,7 +21,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-errors-types.h" #include "mm-errors-types.h"
#include "mm-modem-helpers-simtech.h" #include "mm-modem-helpers-simtech.h"
#include "mm-modem-helpers.h" #include "mm-modem-helpers.h"

View File

@@ -21,7 +21,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-simtech.h" #include "mm-plugin-simtech.h"
#include "mm-broadband-modem-simtech.h" #include "mm-broadband-modem-simtech.h"
@@ -47,7 +47,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 SimTech modem found..."); mm_obj_dbg (self, "QMI-powered SimTech modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_simtech_new (uid, return MM_BASE_MODEM (mm_broadband_modem_qmi_simtech_new (uid,
drivers, drivers,
mm_plugin_get_name (self), mm_plugin_get_name (self),

View File

@@ -21,7 +21,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-iface-modem.h" #include "mm-iface-modem.h"
#include "mm-iface-modem-voice.h" #include "mm-iface-modem-voice.h"
#include "mm-iface-modem-location.h" #include "mm-iface-modem-location.h"
@@ -177,7 +177,7 @@ probe_gps_features (GTask *task)
sources = GPOINTER_TO_UINT (g_task_get_task_data (task)); sources = GPOINTER_TO_UINT (g_task_get_task_data (task));
if (priv->cgps_support == FEATURE_SUPPORTED) { if (priv->cgps_support == FEATURE_SUPPORTED) {
mm_dbg ("GPS commands supported: GPS capabilities enabled"); mm_obj_dbg (self, "GPS commands supported: GPS capabilities enabled");
/* We only flag as supported by this implementation those sources not already /* We only flag as supported by this implementation those sources not already
* supported by the parent implementation */ * supported by the parent implementation */
@@ -196,7 +196,7 @@ probe_gps_features (GTask *task)
self, self,
NULL); NULL);
} else } else
mm_dbg ("No GPS command supported: no GPS capabilities"); mm_obj_dbg (self, "no GPS command supported: no GPS capabilities");
g_task_return_int (task, (gssize) sources); g_task_return_int (task, (gssize) sources);
g_object_unref (task); g_object_unref (task);
@@ -222,7 +222,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
/* Now our own check. If we don't have any GPS port, we're done */ /* Now our own check. If we don't have any GPS port, we're done */
if (!mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) { if (!mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) {
mm_dbg ("No GPS data port found: no GPS capabilities"); mm_obj_dbg (self, "no GPS data port found: no GPS capabilities");
g_task_return_int (task, sources); g_task_return_int (task, sources);
g_object_unref (task); g_object_unref (task);
return; return;
@@ -542,9 +542,9 @@ clcc_command_ready (MMBaseModem *self,
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_base_modem_at_command_finish (self, res, &error)) { if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_dbg ("Couldn't %s +CLCC reporting: '%s'", mm_obj_dbg (self, "couldn't %s +CLCC reporting: '%s'",
ctx->enable ? "enable" : "disable", ctx->enable ? "enable" : "disable",
error->message); error->message);
g_error_free (error); g_error_free (error);
} }
@@ -572,13 +572,13 @@ run_voice_enable_disable_unsolicited_events (GTask *task)
} }
if (!ctx->clcc_primary_done && ctx->primary) { if (!ctx->clcc_primary_done && ctx->primary) {
mm_dbg ("%s +CLCC extended list of current calls reporting in primary port...", mm_obj_dbg (self, "%s +CLCC extended list of current calls reporting in primary port...",
ctx->enable ? "Enabling" : "Disabling"); ctx->enable ? "enabling" : "disabling");
ctx->clcc_primary_done = TRUE; ctx->clcc_primary_done = TRUE;
port = ctx->primary; port = ctx->primary;
} else if (!ctx->clcc_secondary_done && ctx->secondary) { } else if (!ctx->clcc_secondary_done && ctx->secondary) {
mm_dbg ("%s +CLCC extended list of current calls reporting in secondary port...", mm_obj_dbg (self, "%s +CLCC extended list of current calls reporting in secondary port...",
ctx->enable ? "Enabling" : "Disabling"); ctx->enable ? "enabling" : "disabling");
ctx->clcc_secondary_done = TRUE; ctx->clcc_secondary_done = TRUE;
port = ctx->secondary; port = ctx->secondary;
} }
@@ -647,7 +647,7 @@ parent_voice_disable_unsolicited_events_ready (MMIfaceModemVoice *self,
priv = get_private (MM_SHARED_SIMTECH (self)); priv = get_private (MM_SHARED_SIMTECH (self));
if (!priv->iface_modem_voice_parent->disable_unsolicited_events_finish (self, res, &error)) { if (!priv->iface_modem_voice_parent->disable_unsolicited_events_finish (self, res, &error)) {
mm_warn ("Couldn't disable parent voice unsolicited events: %s", error->message); mm_obj_warn (self, "couldn't disable parent voice unsolicited events: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -664,7 +664,7 @@ voice_disable_unsolicited_events_ready (MMSharedSimtech *self,
GError *error = NULL; GError *error = NULL;
if (!common_voice_enable_disable_unsolicited_events_finish (self, res, &error)) { if (!common_voice_enable_disable_unsolicited_events_finish (self, res, &error)) {
mm_warn ("Couldn't disable Simtech-specific voice unsolicited events: %s", error->message); mm_obj_warn (self, "couldn't disable Simtech-specific voice unsolicited events: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -715,7 +715,7 @@ voice_enable_unsolicited_events_ready (MMSharedSimtech *self,
GError *error = NULL; GError *error = NULL;
if (!common_voice_enable_disable_unsolicited_events_finish (self, res, &error)) { if (!common_voice_enable_disable_unsolicited_events_finish (self, res, &error)) {
mm_warn ("Couldn't enable Simtech-specific voice unsolicited events: %s", error->message); mm_obj_warn (self, "couldn't enable Simtech-specific voice unsolicited events: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -734,7 +734,7 @@ parent_voice_enable_unsolicited_events_ready (MMIfaceModemVoice *self,
priv = get_private (MM_SHARED_SIMTECH (self)); priv = get_private (MM_SHARED_SIMTECH (self));
if (!priv->iface_modem_voice_parent->enable_unsolicited_events_finish (self, res, &error)) { if (!priv->iface_modem_voice_parent->enable_unsolicited_events_finish (self, res, &error)) {
mm_warn ("Couldn't enable parent voice unsolicited events: %s", error->message); mm_obj_warn (self, "couldn't enable parent voice unsolicited events: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -782,7 +782,7 @@ clcc_urc_received (MMPortSerialAt *port,
full = g_match_info_fetch (match_info, 0); full = g_match_info_fetch (match_info, 0);
if (!mm_simtech_parse_clcc_list (full, self, &call_info_list, &error)) { if (!mm_simtech_parse_clcc_list (full, self, &call_info_list, &error)) {
mm_warn ("couldn't parse +CLCC list in URC: %s", error->message); mm_obj_warn (self, "couldn't parse +CLCC list in URC: %s", error->message);
g_error_free (error); g_error_free (error);
} else } else
mm_iface_modem_voice_report_all_calls (MM_IFACE_MODEM_VOICE (self), call_info_list); mm_iface_modem_voice_report_all_calls (MM_IFACE_MODEM_VOICE (self), call_info_list);
@@ -800,12 +800,12 @@ missed_call_urc_received (MMPortSerialAt *port,
gchar *details = NULL; gchar *details = NULL;
if (!mm_simtech_parse_missed_call_urc (match_info, &details, &error)) { if (!mm_simtech_parse_missed_call_urc (match_info, &details, &error)) {
mm_warn ("couldn't parse missed call URC: %s", error->message); mm_obj_warn (self, "couldn't parse missed call URC: %s", error->message);
g_error_free (error); g_error_free (error);
return; return;
} }
mm_dbg ("missed call reported: %s", details); mm_obj_dbg (self, "missed call reported: %s", details);
g_free (details); g_free (details);
} }
@@ -819,22 +819,22 @@ voice_call_urc_received (MMPortSerialAt *port,
guint duration = 0; guint duration = 0;
if (!mm_simtech_parse_voice_call_urc (match_info, &start_or_stop, &duration, &error)) { if (!mm_simtech_parse_voice_call_urc (match_info, &start_or_stop, &duration, &error)) {
mm_warn ("couldn't parse VOICE CALL URC: %s", error->message); mm_obj_warn (self, "couldn't parse voice call URC: %s", error->message);
g_error_free (error); g_error_free (error);
return; return;
} }
if (start_or_stop) { if (start_or_stop) {
mm_dbg ("voice call started"); mm_obj_dbg (self, "voice call started");
return; return;
} }
if (duration) { if (duration) {
mm_dbg ("voice call finished (duration: %us)", duration); mm_obj_dbg (self, "voice call finished (duration: %us)", duration);
return; return;
} }
mm_dbg ("voice call finished"); mm_obj_dbg (self, "voice call finished");
} }
static void static void
@@ -842,13 +842,12 @@ cring_urc_received (MMPortSerialAt *port,
GMatchInfo *info, GMatchInfo *info,
MMSharedSimtech *self) MMSharedSimtech *self)
{ {
MMCallInfo call_info; MMCallInfo call_info;
gchar *str; g_autofree gchar *str = NULL;
/* We could have "VOICE" or "DATA". Now consider only "VOICE" */ /* We could have "VOICE" or "DATA". Now consider only "VOICE" */
str = mm_get_string_unquoted_from_match_info (info, 1); str = mm_get_string_unquoted_from_match_info (info, 1);
mm_dbg ("Ringing (%s)", str); mm_obj_dbg (self, "ringing (%s)", str);
g_free (str);
call_info.index = 0; call_info.index = 0;
call_info.direction = MM_CALL_DIRECTION_INCOMING; call_info.direction = MM_CALL_DIRECTION_INCOMING;
@@ -863,13 +862,12 @@ rxdtmf_urc_received (MMPortSerialAt *port,
GMatchInfo *match_info, GMatchInfo *match_info,
MMSharedSimtech *self) MMSharedSimtech *self)
{ {
gchar *dtmf; g_autofree gchar *dtmf = NULL;
dtmf = g_match_info_fetch (match_info, 1); 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 */ /* call index unknown */
mm_iface_modem_voice_received_dtmf (MM_IFACE_MODEM_VOICE (self), 0, dtmf); mm_iface_modem_voice_received_dtmf (MM_IFACE_MODEM_VOICE (self), 0, dtmf);
g_free (dtmf);
} }
static void static void
@@ -944,7 +942,7 @@ parent_voice_cleanup_unsolicited_events_ready (MMIfaceModemVoice *self,
priv = get_private (MM_SHARED_SIMTECH (self)); priv = get_private (MM_SHARED_SIMTECH (self));
if (!priv->iface_modem_voice_parent->cleanup_unsolicited_events_finish (self, res, &error)) { if (!priv->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); g_error_free (error);
} }
@@ -999,7 +997,7 @@ parent_voice_setup_unsolicited_events_ready (MMIfaceModemVoice *self,
priv = get_private (MM_SHARED_SIMTECH (self)); priv = get_private (MM_SHARED_SIMTECH (self));
if (!priv->iface_modem_voice_parent->setup_unsolicited_events_finish (self, res, &error)) { if (!priv->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); g_error_free (error);
} }
@@ -1150,7 +1148,7 @@ cpcmreg_format_check_ready (MMBroadbandModem *self,
priv->cpcmreg_support = (mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL) ? priv->cpcmreg_support = (mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL) ?
FEATURE_SUPPORTED : FEATURE_NOT_SUPPORTED); FEATURE_SUPPORTED : FEATURE_NOT_SUPPORTED);
mm_dbg ("modem %s USB audio control", (priv->cpcmreg_support == FEATURE_SUPPORTED) ? "supports" : "doesn't support"); mm_obj_dbg (self, "modem %s USB audio control", (priv->cpcmreg_support == FEATURE_SUPPORTED) ? "supports" : "doesn't support");
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
g_object_unref (task); g_object_unref (task);
@@ -1170,12 +1168,12 @@ clcc_format_check_ready (MMBroadbandModem *self,
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL); response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL);
if (response && !mm_simtech_parse_clcc_test (response, &clcc_urc_supported, &error)) { if (response && !mm_simtech_parse_clcc_test (response, &clcc_urc_supported, &error)) {
mm_dbg ("failed checking CLCC URC support: %s", error->message); mm_obj_dbg (self, "failed checking CLCC URC support: %s", error->message);
g_clear_error (&error); g_clear_error (&error);
} }
priv->clcc_urc_support = (clcc_urc_supported ? FEATURE_SUPPORTED : FEATURE_NOT_SUPPORTED); priv->clcc_urc_support = (clcc_urc_supported ? FEATURE_SUPPORTED : FEATURE_NOT_SUPPORTED);
mm_dbg ("modem %s +CLCC URCs", (priv->clcc_urc_support == FEATURE_SUPPORTED) ? "supports" : "doesn't support"); mm_obj_dbg (self, "modem %s +CLCC URCs", (priv->clcc_urc_support == FEATURE_SUPPORTED) ? "supports" : "doesn't support");
/* If +CLCC URC supported we won't need polling in the parent */ /* If +CLCC URC supported we won't need polling in the parent */
g_object_set (self, g_object_set (self,