core: use MM-specific logging methods always instead of the generic GLib ones
This commit is contained in:
@@ -1008,7 +1008,7 @@ syscfg_test_ready (MMBroadbandModemHuawei *self,
|
||||
combinations,
|
||||
(GDestroyNotify)g_array_unref);
|
||||
} else {
|
||||
g_debug ("Error while checking ^SYSCFG format: %s", error->message);
|
||||
mm_dbg ("Error while checking ^SYSCFG format: %s", error->message);
|
||||
/* If SIM-PIN error, don't mark as feature unsupported; we'll retry later */
|
||||
if (!g_error_matches (error,
|
||||
MM_MOBILE_EQUIPMENT_ERROR,
|
||||
@@ -1066,7 +1066,7 @@ syscfgex_test_ready (MMBroadbandModemHuawei *self,
|
||||
|
||||
/* If SIM-PIN error, don't mark as feature unsupported; we'll retry later */
|
||||
if (error) {
|
||||
g_debug ("Error while checking ^SYSCFGEX format: %s", error->message);
|
||||
mm_dbg ("Error while checking ^SYSCFGEX format: %s", error->message);
|
||||
if (g_error_matches (error,
|
||||
MM_MOBILE_EQUIPMENT_ERROR,
|
||||
MM_MOBILE_EQUIPMENT_ERROR_SIM_PIN)) {
|
||||
@@ -1127,7 +1127,7 @@ prefmode_test_ready (MMBroadbandModemHuawei *self,
|
||||
combinations,
|
||||
(GDestroyNotify)g_array_unref);
|
||||
} else {
|
||||
g_debug ("Error while checking ^PREFMODE format: %s", error->message);
|
||||
mm_dbg ("Error while checking ^PREFMODE format: %s", error->message);
|
||||
/* If SIM-PIN error, don't mark as feature unsupported; we'll retry later */
|
||||
if (!g_error_matches (error,
|
||||
MM_MOBILE_EQUIPMENT_ERROR,
|
||||
@@ -2163,7 +2163,7 @@ peek_port_at_for_data (MMBroadbandModemHuawei *self,
|
||||
g_warn_if_fail (mm_port_get_subsys (port) == MM_PORT_SUBSYS_NET);
|
||||
net_port_parent_path = mm_port_get_parent_path (port);
|
||||
if (!net_port_parent_path) {
|
||||
g_warning ("(%s) no parent path for net port", mm_port_get_device (port));
|
||||
mm_warn ("(%s) no parent path for net port", mm_port_get_device (port));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-modem-helpers-mbm.h"
|
||||
|
||||
@@ -175,7 +176,7 @@ add_supported_mode (guint32 *mask,
|
||||
g_assert (mask);
|
||||
|
||||
if (mode >= 32)
|
||||
g_warning ("Ignored unexpected mode in +CFUN match: %d", mode);
|
||||
mm_warn ("Ignored unexpected mode in +CFUN match: %d", mode);
|
||||
else
|
||||
*mask |= (1 << mode);
|
||||
}
|
||||
@@ -236,18 +237,18 @@ mm_mbm_parse_cfun_test (const gchar *response,
|
||||
last_str = separator + 1;
|
||||
|
||||
if (!mm_get_uint_from_str (first_str, &first))
|
||||
g_warning ("Couldn't match range start: '%s'", first_str);
|
||||
mm_warn ("Couldn't match range start: '%s'", first_str);
|
||||
else if (!mm_get_uint_from_str (last_str, &last))
|
||||
g_warning ("Couldn't match range stop: '%s'", last_str);
|
||||
mm_warn ("Couldn't match range stop: '%s'", last_str);
|
||||
else if (first >= last)
|
||||
g_warning ("Couldn't match range: wrong first '%s' and last '%s' items", first_str, last_str);
|
||||
mm_warn ("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);
|
||||
}
|
||||
} else {
|
||||
if (!mm_get_uint_from_str (supported_modes[i], &mode))
|
||||
g_warning ("Couldn't match mode: '%s'", supported_modes[i]);
|
||||
mm_warn ("Couldn't match mode: '%s'", supported_modes[i]);
|
||||
else
|
||||
add_supported_mode (&mask, mode);
|
||||
}
|
||||
|
@@ -175,7 +175,7 @@ reload_stats_ready (MMBaseBearer *self,
|
||||
guint64 tx_bytes = 0;
|
||||
|
||||
if (!MM_BASE_BEARER_GET_CLASS (self)->reload_stats_finish (self, &rx_bytes, &tx_bytes, res, &error)) {
|
||||
g_warning ("Reloading stats failed: %s", error->message);
|
||||
mm_warn ("Reloading stats failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
@@ -1015,7 +1015,7 @@ release_qmi_client_dms_ready (QmiDevice *dev,
|
||||
|
||||
/* Non-fatal error */
|
||||
if (!qmi_device_release_client_finish (dev, res, &error)) {
|
||||
g_debug ("error: couldn't release client: %s", error->message);
|
||||
mm_dbg ("error: couldn't release client: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
@@ -1045,7 +1045,7 @@ set_fcc_authentication_ready (QmiClientDms *client,
|
||||
|
||||
output = qmi_client_dms_set_fcc_authentication_finish (client, res, &error);
|
||||
if (!output || !qmi_message_dms_set_fcc_authentication_output_get_result (output, &error)) {
|
||||
g_debug ("error: couldn't set FCC auth: %s", error->message);
|
||||
mm_dbg ("error: couldn't set FCC auth: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_assert (ctx->saved_error);
|
||||
g_simple_async_result_take_error (ctx->result, ctx->saved_error);
|
||||
@@ -1082,7 +1082,7 @@ qmi_client_dms_ready (QmiDevice *dev,
|
||||
|
||||
ctx->qmi_client = qmi_device_allocate_client_finish (dev, res, &error);
|
||||
if (!ctx->qmi_client) {
|
||||
g_debug ("error: couldn't create DMS client: %s", error->message);
|
||||
mm_dbg ("error: couldn't create DMS client: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_assert (ctx->saved_error);
|
||||
g_simple_async_result_take_error (ctx->result, ctx->saved_error);
|
||||
@@ -1116,7 +1116,7 @@ device_open_ready (QmiDevice *dev,
|
||||
GError *error = NULL;
|
||||
|
||||
if (!qmi_device_open_finish (dev, res, &error)) {
|
||||
g_debug ("error: couldn't open QmiDevice: %s", error->message);
|
||||
mm_dbg ("error: couldn't open QmiDevice: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_assert (ctx->saved_error);
|
||||
g_simple_async_result_take_error (ctx->result, ctx->saved_error);
|
||||
@@ -1151,7 +1151,7 @@ qmi_device_new_ready (GObject *unused,
|
||||
|
||||
ctx->qmi_device = qmi_device_new_finish (res, &error);
|
||||
if (!ctx->qmi_device) {
|
||||
g_debug ("error: couldn't create QmiDevice: %s", error->message);
|
||||
mm_dbg ("error: couldn't create QmiDevice: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_assert (ctx->saved_error);
|
||||
g_simple_async_result_take_error (ctx->result, ctx->saved_error);
|
||||
@@ -1221,7 +1221,7 @@ radio_state_set_up_ready (MbimDevice *device,
|
||||
/* Only the first attempt isn't fatal */
|
||||
if (ctx->step == POWER_UP_CONTEXT_STEP_FIRST) {
|
||||
/* Warn and keep, will retry */
|
||||
g_warning ("%s", error->message);
|
||||
mm_warn ("%s", error->message);
|
||||
g_assert (!ctx->saved_error);
|
||||
ctx->saved_error = error;
|
||||
ctx->step++;
|
||||
|
@@ -1238,7 +1238,7 @@ dms_get_ids_ready (QmiClientDms *client,
|
||||
else if (len == 8)
|
||||
ctx->self->priv->esn = g_strdup (str);
|
||||
else
|
||||
g_debug ("Invalid ESN reported: '%s' (unexpected length)", str);
|
||||
mm_dbg ("Invalid ESN reported: '%s' (unexpected length)", str);
|
||||
}
|
||||
|
||||
if (qmi_message_dms_get_ids_output_get_meid (output, &str, NULL) &&
|
||||
@@ -1248,7 +1248,7 @@ dms_get_ids_ready (QmiClientDms *client,
|
||||
if (len == 14)
|
||||
ctx->self->priv->meid = g_strdup (str);
|
||||
else
|
||||
g_debug ("Invalid MEID reported: '%s' (unexpected length)", str);
|
||||
mm_dbg ("Invalid MEID reported: '%s' (unexpected length)", str);
|
||||
}
|
||||
|
||||
if (ctx->self->priv->imei)
|
||||
@@ -1504,7 +1504,7 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
}
|
||||
|
||||
if (cards->len > 1)
|
||||
g_debug ("Multiple cards reported: %u", cards->len);
|
||||
mm_dbg ("Multiple cards reported: %u", cards->len);
|
||||
|
||||
/* All KNOWN applications in all cards will need to be in READY state for us
|
||||
* to consider UNLOCKED */
|
||||
@@ -1517,25 +1517,25 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
gboolean sim_usim_found = FALSE;
|
||||
|
||||
if (card->applications->len == 0) {
|
||||
g_debug ("No applications reported in card [%u]", i);
|
||||
mm_dbg ("No applications reported in card [%u]", i);
|
||||
n_invalid++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (card->applications->len > 1)
|
||||
g_debug ("Multiple applications reported in card [%u]: %u", i, card->applications->len);
|
||||
mm_dbg ("Multiple applications reported in card [%u]: %u", i, card->applications->len);
|
||||
|
||||
for (j = 0; j < card->applications->len; j++) {
|
||||
app = &g_array_index (card->applications, QmiMessageUimGetCardStatusOutputCardStatusCardsElementApplicationsElement, j);
|
||||
|
||||
if (app->type == QMI_UIM_CARD_APPLICATION_TYPE_UNKNOWN) {
|
||||
g_debug ("Unknown application [%u] found in card [%u]: %s. Ignored.",
|
||||
j, i, qmi_uim_card_application_state_get_string (app->state));
|
||||
mm_dbg ("Unknown application [%u] found in card [%u]: %s. Ignored.",
|
||||
j, i, qmi_uim_card_application_state_get_string (app->state));
|
||||
continue;
|
||||
}
|
||||
|
||||
g_debug ("Application '%s' [%u] in card [%u]: %s",
|
||||
qmi_uim_card_application_type_get_string (app->type), j, i, qmi_uim_card_application_state_get_string (app->state));
|
||||
mm_dbg ("Application '%s' [%u] in card [%u]: %s",
|
||||
qmi_uim_card_application_type_get_string (app->type), j, i, qmi_uim_card_application_state_get_string (app->state));
|
||||
|
||||
if (app->type == QMI_UIM_CARD_APPLICATION_TYPE_SIM || app->type == QMI_UIM_CARD_APPLICATION_TYPE_USIM) {
|
||||
/* We found the card/app pair to use! Only keep the first found,
|
||||
@@ -1550,7 +1550,7 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
}
|
||||
|
||||
if (!sim_usim_found) {
|
||||
g_debug ("No SIM/USIM application found in card [%u]", i);
|
||||
mm_dbg ("No SIM/USIM application found in card [%u]", i);
|
||||
n_invalid++;
|
||||
}
|
||||
|
||||
@@ -1558,7 +1558,7 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
}
|
||||
|
||||
case QMI_UIM_CARD_STATE_ABSENT:
|
||||
g_debug ("Card '%u' is absent", i);
|
||||
mm_dbg ("Card '%u' is absent", i);
|
||||
n_absent++;
|
||||
break;
|
||||
|
||||
@@ -1566,9 +1566,9 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
default:
|
||||
n_error++;
|
||||
if (qmi_uim_card_error_get_string (card->error_code) != NULL)
|
||||
g_warning ("Card '%u' is unusable: %s", i, qmi_uim_card_error_get_string (card->error_code));
|
||||
mm_warn ("Card '%u' is unusable: %s", i, qmi_uim_card_error_get_string (card->error_code));
|
||||
else
|
||||
g_warning ("Card '%u' is unusable: unknown error", i);
|
||||
mm_warn ("Card '%u' is unusable: unknown error", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1608,7 +1608,7 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
app->state != QMI_UIM_CARD_APPLICATION_STATE_PIN1_OR_UPIN_PIN_REQUIRED &&
|
||||
app->state != QMI_UIM_CARD_APPLICATION_STATE_PUK1_OR_UPIN_PUK_REQUIRED &&
|
||||
app->state != QMI_UIM_CARD_APPLICATION_STATE_PIN1_BLOCKED) {
|
||||
g_debug ("Neither SIM nor USIM are ready");
|
||||
mm_dbg ("Neither SIM nor USIM are ready");
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_RETRY,
|
||||
"SIM not ready yet (retry)");
|
||||
return FALSE;
|
||||
@@ -1669,7 +1669,7 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
break;
|
||||
|
||||
case QMI_UIM_PIN_STATE_PERMANENTLY_BLOCKED:
|
||||
g_warning ("PUK2 permanently blocked");
|
||||
mm_warn ("PUK2 permanently blocked");
|
||||
case QMI_UIM_PIN_STATE_BLOCKED:
|
||||
lock = MM_MODEM_LOCK_SIM_PUK2;
|
||||
break;
|
||||
@@ -1679,7 +1679,7 @@ uim_get_card_status_output_parse (QmiMessageUimGetCardStatusOutput *output,
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Unknown SIM PIN2/PUK2 status");
|
||||
mm_warn ("Unknown SIM PIN2/PUK2 status");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -7691,7 +7691,7 @@ wms_list_messages_ready (QmiClientWms *client,
|
||||
|
||||
if (!qmi_message_wms_list_messages_output_get_result (output, &error)) {
|
||||
/* Ignore error, keep on */
|
||||
g_debug ("Couldn't read SMS messages: %s", error->message);
|
||||
mm_dbg ("Couldn't read SMS messages: %s", error->message);
|
||||
g_error_free (error);
|
||||
ctx->step++;
|
||||
load_initial_sms_parts_step (ctx);
|
||||
@@ -9730,7 +9730,7 @@ oma_event_report_indication_cb (QmiClientNas *client,
|
||||
|
||||
session_type = mm_oma_session_type_from_qmi_oma_session_type (network_initiated_alert_session_type);
|
||||
if (session_type == MM_OMA_SESSION_TYPE_UNKNOWN)
|
||||
g_warning ("Unknown QMI OMA session type '%u'", network_initiated_alert_session_type);
|
||||
mm_warn ("Unknown QMI OMA session type '%u'", network_initiated_alert_session_type);
|
||||
else
|
||||
mm_iface_modem_oma_add_pending_network_initiated_session (
|
||||
MM_IFACE_MODEM_OMA (self),
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-charsets.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
typedef struct {
|
||||
const char *gsm_name;
|
||||
@@ -130,9 +131,8 @@ mm_modem_charset_byte_array_append (GByteArray *array,
|
||||
converted = g_convert (utf8, -1, iconv_to, "UTF-8", NULL, &written, &error);
|
||||
if (!converted) {
|
||||
if (error) {
|
||||
g_warning ("%s: failed to convert '%s' to %s character set: (%d) %s",
|
||||
__func__, utf8, iconv_to,
|
||||
error->code, error->message);
|
||||
mm_warn ("failed to convert '%s' to %s character set: (%d) %s",
|
||||
utf8, iconv_to, error->code, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
return FALSE;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "mm-error-helpers.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -50,7 +51,7 @@ mm_connection_error_for_code (MMConnectionError code)
|
||||
break;
|
||||
|
||||
default:
|
||||
g_debug ("Invalid connection error code: %u", code);
|
||||
mm_dbg ("Invalid connection error code: %u", code);
|
||||
/* uhm... make something up (yes, ok, lie!). */
|
||||
code = MM_CONNECTION_ERROR_NO_CARRIER;
|
||||
msg = "No carrier";
|
||||
@@ -127,7 +128,7 @@ mm_mobile_equipment_error_for_code (MMMobileEquipmentError code)
|
||||
}
|
||||
|
||||
/* Not found? Then, default */
|
||||
g_debug ("Invalid mobile equipment error code: %u", (guint)code);
|
||||
mm_dbg ("Invalid mobile equipment error code: %u", (guint)code);
|
||||
return g_error_new (MM_MOBILE_EQUIPMENT_ERROR,
|
||||
MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN,
|
||||
"Unknown error");
|
||||
@@ -163,8 +164,7 @@ mm_mobile_equipment_error_for_string (const gchar *str)
|
||||
|
||||
/* Not found? Then, default */
|
||||
if (!msg) {
|
||||
g_debug ("Invalid mobile equipment error string: '%s' (%s)",
|
||||
str, buf);
|
||||
mm_dbg ("Invalid mobile equipment error string: '%s' (%s)", str, buf);
|
||||
code = MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN;
|
||||
msg = "Unknown error";
|
||||
}
|
||||
@@ -215,7 +215,7 @@ mm_message_error_for_code (MMMessageError code)
|
||||
}
|
||||
|
||||
/* Not found? Then, default */
|
||||
g_debug ("Invalid message error code: %u", (guint)code);
|
||||
mm_dbg ("Invalid message error code: %u", (guint)code);
|
||||
return g_error_new (MM_MESSAGE_ERROR,
|
||||
MM_MESSAGE_ERROR_UNKNOWN,
|
||||
"Unknown error");
|
||||
@@ -251,8 +251,7 @@ mm_message_error_for_string (const gchar *str)
|
||||
|
||||
/* Not found? Then, default */
|
||||
if (!msg) {
|
||||
g_debug ("Invalid message error string: '%s' (%s)",
|
||||
str, buf);
|
||||
mm_dbg ("Invalid message error string: '%s' (%s)", str, buf);
|
||||
code = MM_MESSAGE_ERROR_UNKNOWN;
|
||||
msg = "Unknown error";
|
||||
}
|
||||
|
@@ -3371,7 +3371,7 @@ set_power_state_load_ready (MMIfaceModem *self,
|
||||
|
||||
ctx->previous_real_power_state = MM_IFACE_MODEM_GET_INTERFACE (self)->load_power_state_finish (self, res, &error);
|
||||
if (error) {
|
||||
g_debug ("Couldn't reload current power state: %s", error->message);
|
||||
mm_dbg ("Couldn't reload current power state: %s", error->message);
|
||||
g_error_free (error);
|
||||
/* Default to the cached one */
|
||||
ctx->previous_real_power_state = ctx->previous_cached_power_state;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
static void
|
||||
test_def_chars (void *f, gpointer d)
|
||||
@@ -361,6 +362,25 @@ test_take_convert_ucs2_bad_ascii2 (void *f, gpointer d)
|
||||
g_assert (converted == NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_mm_log (const char *loc,
|
||||
const char *func,
|
||||
guint32 level,
|
||||
const char *fmt,
|
||||
...)
|
||||
{
|
||||
#if defined ENABLE_TEST_MESSAGE_TRACES
|
||||
/* Dummy log function */
|
||||
va_list args;
|
||||
gchar *msg;
|
||||
|
||||
va_start (args, fmt);
|
||||
msg = g_strdup_vprintf (fmt, args);
|
||||
va_end (args);
|
||||
g_print ("%s\n", msg);
|
||||
g_free (msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef GTestFixtureFunc TCFunc;
|
||||
|
||||
|
Reference in New Issue
Block a user