option,hso: port to use object logging

This commit is contained in:
Aleksander Morgado
2020-04-08 16:35:09 +02:00
parent 4e0a9b1985
commit 662f8afc56
4 changed files with 22 additions and 23 deletions
+16 -14
View File
@@ -30,7 +30,7 @@
#include "mm-base-modem-at.h"
#include "mm-broadband-bearer-hso.h"
#include "mm-log.h"
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-daemon-enums-types.h"
@@ -380,14 +380,13 @@ activate_ready (MMBaseModem *modem,
Dial3gppContext *ctx;
GError *error = NULL;
task = self->priv->connect_pending;
self->priv->connect_pending = NULL;
task = g_steal_pointer (&self->priv->connect_pending);
/* Try to recover the connection task. If none found, it means the
* task was already completed and we have nothing else to do.
* But note that we won't take owneship of the task yet! */
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
* about the result */
mm_base_modem_at_command_full_finish (modem, res, NULL);
@@ -517,7 +516,7 @@ authenticate (GTask *task)
/* Both user and password are required; otherwise firmware returns an error */
if (!user || !password || allowed_auth == MM_BEARER_ALLOWED_AUTH_NONE) {
mm_dbg ("Not using authentication");
mm_obj_dbg (self, "not using authentication");
command = g_strdup_printf ("%s=%d,0",
auth_commands[ctx->auth_idx],
ctx->cid);
@@ -527,13 +526,13 @@ authenticate (GTask *task)
guint hso_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");
hso_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");
hso_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");
hso_auth = 2;
} else {
gchar *str;
@@ -639,16 +638,19 @@ disconnect_3gpp_finish (MMBroadbandBearer *self,
}
static void
disconnect_owancall_ready (MMBaseModem *modem,
disconnect_owancall_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
GTask *task)
{
GError *error = NULL;
MMBroadbandBearerHso *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);
}
@@ -711,8 +713,8 @@ report_connection_status (MMBaseBearer *_self,
return;
}
mm_dbg ("Received spontaneous _OWANCALL (%s)",
mm_bearer_connection_status_get_string (status));
mm_obj_dbg (self, "received spontaneous _OWANCALL (%s)",
mm_bearer_connection_status_get_string (status));
if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) {
/* If no connection attempt on-going, make sure we mark ourselves as
+3 -4
View File
@@ -25,7 +25,7 @@
#include "ModemManager.h"
#include "mm-modem-helpers.h"
#include "mm-log.h"
#include "mm-log-object.h"
#include "mm-errors-types.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-3gpp.h"
@@ -111,7 +111,7 @@ modem_create_bearer (MMIfaceModem *self,
if (mm_bearer_properties_get_ip_type (properties) &
(MM_BEARER_IP_FAMILY_IPV6 | MM_BEARER_IP_FAMILY_IPV4V6)) {
mm_dbg ("Creating generic bearer (IPv6 requested)...");
mm_obj_dbg (self, "creating generic bearer (IPv6 requested)...");
mm_broadband_bearer_new (MM_BROADBAND_MODEM (self),
properties,
NULL, /* cancellable */
@@ -120,7 +120,7 @@ modem_create_bearer (MMIfaceModem *self,
return;
}
mm_dbg ("Creating HSO bearer...");
mm_obj_dbg (self, "creating HSO bearer...");
mm_broadband_bearer_hso_new (MM_BROADBAND_MODEM_HSO (self),
properties,
NULL, /* cancellable */
@@ -150,7 +150,6 @@ load_unlock_retries_ready (MMBaseModem *self,
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (!response) {
mm_dbg ("Couldn't query unlock retries: '%s'", error->message);
g_task_return_error (task, error);
g_object_unref (task);
return;
+1 -3
View File
@@ -25,7 +25,7 @@
#include "ModemManager.h"
#include "mm-modem-helpers.h"
#include "mm-log.h"
#include "mm-log-object.h"
#include "mm-errors-types.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-3gpp.h"
@@ -712,7 +712,6 @@ modem_3gpp_load_imei_finish (MMIfaceModem3gpp *self,
if (comma)
*comma = '\0';
mm_dbg ("loaded IMEI: %s", imei);
return imei;
}
@@ -721,7 +720,6 @@ modem_3gpp_load_imei (MMIfaceModem3gpp *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
mm_dbg ("loading (Option) IMEI...");
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CGSN",
3,
+2 -2
View File
@@ -24,7 +24,7 @@
#include "mm-private-boxed-types.h"
#include "mm-plugin-hso.h"
#include "mm-broadband-modem-hso.h"
#include "mm-log.h"
#include "mm-log-object.h"
G_DEFINE_TYPE (MMPluginHso, mm_plugin_hso, MM_TYPE_PLUGIN)
@@ -70,7 +70,7 @@ hso_custom_init (MMPortProbe *probe,
hsotype_path = g_build_filename (sysfs_path, "hsotype", NULL);
if (g_file_get_contents (hsotype_path, &contents, NULL, NULL)) {
mm_dbg ("HSO port type %s: %s", hsotype_path, contents);
mm_obj_dbg (probe, "HSO port type %s: %s", hsotype_path, contents);
if (g_str_has_prefix (contents, "Control")) {
g_object_set_data (G_OBJECT (probe), TAG_HSO_AT_CONTROL, GUINT_TO_POINTER (TRUE));
mm_port_probe_set_result_at (probe, TRUE);