From b3f315ad2db5455156781f1cfc22ecfb46bc389e Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 5 Aug 2022 14:40:24 +0200 Subject: [PATCH] core,log: new 'MSG' log level between 'INFO' and 'WARN' We're bumping the current "INFO" level messages to the new "MSG" level, also making the new level the default. The old "INFO" level will be used to setup an intermediate level of logging which is not as verbose as "DEBUG" but still provides some capabilities to analyze the behavior of a modem. --- cli/mmcli-manager.c | 2 +- .../org.freedesktop.ModemManager1.xml | 3 +- .../cinterion/mm-broadband-modem-cinterion.c | 8 +-- plugins/novatel/mm-broadband-modem-novatel.c | 10 +-- plugins/sierra/mm-broadband-modem-sierra.c | 18 +++--- plugins/telit/mm-broadband-modem-telit.c | 2 +- plugins/ublox/mm-broadband-modem-ublox.c | 4 +- src/main.c | 8 +-- src/mm-base-bearer.c | 6 +- src/mm-base-call.c | 24 +++---- src/mm-base-manager.c | 26 ++++---- src/mm-base-sim.c | 2 +- src/mm-bearer-mbim.c | 2 +- src/mm-bearer-qmi.c | 64 +++++++++---------- src/mm-broadband-modem-mbim.c | 6 +- src/mm-broadband-modem-qmi.c | 30 ++++----- src/mm-broadband-modem.c | 58 ++++++++--------- src/mm-device.c | 12 ++-- src/mm-iface-modem-3gpp.c | 14 ++-- src/mm-iface-modem-oma.c | 6 +- src/mm-iface-modem-simple.c | 42 ++++++------ src/mm-iface-modem.c | 8 +-- src/mm-log.c | 13 +++- src/mm-log.h | 7 +- src/mm-port-mbim.c | 8 +-- src/mm-port-qmi.c | 2 +- src/mm-qrtr-bus-watcher.c | 4 +- src/mm-shared-qmi.c | 18 +++--- src/mm-sleep-monitor-powerd.c | 4 +- src/mm-sleep-monitor-systemd.c | 4 +- tools/tests/test-stub.c | 12 ++-- 31 files changed, 219 insertions(+), 208 deletions(-) diff --git a/cli/mmcli-manager.c b/cli/mmcli-manager.c index 70903f91..9cd7d7db 100644 --- a/cli/mmcli-manager.c +++ b/cli/mmcli-manager.c @@ -70,7 +70,7 @@ static GOptionEntry entries[] = { }, { "set-logging", 'G', 0, G_OPTION_ARG_STRING, &set_logging_str, "Set logging level in the ModemManager daemon", - "[ERR,WARN,INFO,DEBUG]", + "[ERR,WARN,MSG,INFO,DEBUG]", }, { "list-modems", 'L', 0, G_OPTION_ARG_NONE, &list_modems_flag, "List available modems", diff --git a/introspection/org.freedesktop.ModemManager1.xml b/introspection/org.freedesktop.ModemManager1.xml index e80e0cd3..adaf592e 100644 --- a/introspection/org.freedesktop.ModemManager1.xml +++ b/introspection/org.freedesktop.ModemManager1.xml @@ -31,7 +31,8 @@ '%s'", - mm_modem_cdma_activation_state_get_string (self->priv->activation_state), - mm_modem_cdma_activation_state_get_string (new)); + mm_obj_msg (self, "activation state changed: '%s'-->'%s'", + mm_modem_cdma_activation_state_get_string (self->priv->activation_state), + mm_modem_cdma_activation_state_get_string (new)); /* Cache the new value */ self->priv->activation_state = new; @@ -5138,7 +5138,7 @@ cdma_activation_context_step (GTask *task) if (ctx->input_automatic) { QmiMessageDmsSetEventReportInput *input; - mm_obj_info (ctx->self, "activation step [1/5]: enabling indications"); + mm_obj_msg (ctx->self, "activation step [1/5]: enabling indications"); input = qmi_message_dms_set_event_report_input_new (); qmi_message_dms_set_event_report_input_set_activation_state_reporting (input, TRUE, NULL); qmi_client_dms_set_event_report ( @@ -5154,14 +5154,14 @@ cdma_activation_context_step (GTask *task) /* Manual activation, no indications needed */ g_assert (ctx->input_manual != NULL); - mm_obj_info (ctx->self, "activation step [1/5]: indications not needed in manual activation"); + mm_obj_msg (ctx->self, "activation step [1/5]: indications not needed in manual activation"); ctx->step++; /* Fall through */ case CDMA_ACTIVATION_STEP_REQUEST_ACTIVATION: /* Automatic activation */ if (ctx->input_automatic) { - mm_obj_info (ctx->self, "activation step [2/5]: requesting automatic (OTA) activation"); + mm_obj_msg (ctx->self, "activation step [2/5]: requesting automatic (OTA) activation"); qmi_client_dms_activate_automatic (ctx->client, ctx->input_automatic, 10, @@ -5174,9 +5174,9 @@ cdma_activation_context_step (GTask *task) /* Manual activation */ g_assert (ctx->input_manual != NULL); if (!ctx->segments) - mm_obj_info (ctx->self, "activation step [2/5]: requesting manual activation"); + mm_obj_msg (ctx->self, "activation step [2/5]: requesting manual activation"); else { - mm_obj_info (ctx->self, "activation step [2/5]: requesting manual activation (PRL segment %u/%u)", + mm_obj_msg (ctx->self, "activation step [2/5]: requesting manual activation (PRL segment %u/%u)", (ctx->segment_i + 1), ctx->n_segments); qmi_message_dms_activate_manual_input_set_prl ( ctx->input_manual, @@ -5198,14 +5198,14 @@ cdma_activation_context_step (GTask *task) /* Automatic activation */ if (ctx->input_automatic) { /* State updates via unsolicited messages */ - mm_obj_info (ctx->self, "activation step [3/5]: waiting for activation state updates"); + mm_obj_msg (ctx->self, "activation step [3/5]: waiting for activation state updates"); return; } /* Manual activation; needs MSISDN checks */ g_assert (ctx->input_manual != NULL); ctx->n_mdn_check_retries++; - mm_obj_info (ctx->self, "activation step [3/5]: checking MDN update (retry %u)", ctx->n_mdn_check_retries); + mm_obj_msg (ctx->self, "activation step [3/5]: checking MDN update (retry %u)", ctx->n_mdn_check_retries); qmi_client_dms_get_msisdn (ctx->client, NULL, 5, @@ -5215,14 +5215,14 @@ cdma_activation_context_step (GTask *task) return; case CDMA_ACTIVATION_STEP_RESET: - mm_obj_info (ctx->self, "activation step [4/5]: power-cycling..."); + mm_obj_msg (ctx->self, "activation step [4/5]: power-cycling..."); mm_shared_qmi_reset (MM_IFACE_MODEM (ctx->self), (GAsyncReadyCallback)activation_reset_ready, task); return; case CDMA_ACTIVATION_STEP_LAST: - mm_obj_info (ctx->self, "activation step [5/5]: finished"); + mm_obj_msg (ctx->self, "activation step [5/5]: finished"); g_task_return_boolean (task, TRUE); g_object_unref (task); return; @@ -13069,7 +13069,7 @@ wds_set_autoconnect_settings_ready (QmiClientWds *client, if (!output || !qmi_message_wds_set_autoconnect_settings_output_get_result (output, &error)) mm_obj_warn (self, "failed disabling autoconnect: %s", error->message); else - mm_obj_info (self, "autoconnect explicitly disabled"); + mm_obj_msg (self, "autoconnect explicitly disabled"); g_task_return_boolean (task, TRUE); g_object_unref (task); } @@ -13259,8 +13259,8 @@ qmi_device_removed_cb (QmiDevice *device, MMBroadbandModemQmi *self) { /* Reprobe the modem here so we can get notifications back. */ - mm_obj_info (self, "connection to qmi-proxy for %s lost, reprobing", - qmi_device_get_path_display (device)); + mm_obj_msg (self, "connection to qmi-proxy for %s lost, reprobing", + qmi_device_get_path_display (device)); g_signal_handler_disconnect (device, self->priv->qmi_device_removed_id); self->priv->qmi_device_removed_id = 0; diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index a9d4cd73..70b4bb2a 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -2909,7 +2909,7 @@ bearer_report_disconnected (MMBaseBearer *bearer, if (mm_base_bearer_get_status (bearer) == MM_BEARER_STATUS_DISCONNECTED) return; - mm_obj_info (bearer, "explicitly disconnected"); + mm_obj_msg (bearer, "explicitly disconnected"); mm_base_bearer_report_connection_status (bearer, MM_BEARER_CONNECTION_STATUS_DISCONNECTED); } @@ -2933,13 +2933,13 @@ cgev_process_detach (MMBroadbandModem *self, MM3gppCgev type) { if (type == MM_3GPP_CGEV_NW_DETACH) { - mm_obj_info (self, "network forced PS detach: all contexts have been deactivated"); + mm_obj_msg (self, "network forced PS detach: all contexts have been deactivated"); bearer_list_report_disconnections (self, MM_3GPP_PROFILE_ID_UNKNOWN); return; } if (type == MM_3GPP_CGEV_ME_DETACH) { - mm_obj_info (self, "mobile equipment forced PS detach: all contexts have been deactivated"); + mm_obj_msg (self, "mobile equipment forced PS detach: all contexts have been deactivated"); bearer_list_report_disconnections (self, MM_3GPP_PROFILE_ID_UNKNOWN); return; } @@ -2963,17 +2963,17 @@ cgev_process_primary (MMBroadbandModem *self, switch (type) { case MM_3GPP_CGEV_NW_ACT_PRIMARY: - mm_obj_info (self, "network request to activate context (cid %u)", cid); + mm_obj_msg (self, "network request to activate context (cid %u)", cid); break; case MM_3GPP_CGEV_ME_ACT_PRIMARY: - mm_obj_info (self, "mobile equipment request to activate context (cid %u)", cid); + mm_obj_msg (self, "mobile equipment request to activate context (cid %u)", cid); break; case MM_3GPP_CGEV_NW_DEACT_PRIMARY: - mm_obj_info (self, "network request to deactivate context (cid %u)", cid); + mm_obj_msg (self, "network request to deactivate context (cid %u)", cid); bearer_list_report_disconnections (self, (gint)cid); break; case MM_3GPP_CGEV_ME_DEACT_PRIMARY: - mm_obj_info (self, "mobile equipment request to deactivate context (cid %u)", cid); + mm_obj_msg (self, "mobile equipment request to deactivate context (cid %u)", cid); bearer_list_report_disconnections (self, (gint)cid); break; case MM_3GPP_CGEV_UNKNOWN: @@ -3014,17 +3014,17 @@ cgev_process_secondary (MMBroadbandModem *self, switch (type) { case MM_3GPP_CGEV_NW_ACT_SECONDARY: - mm_obj_info (self, "network request to activate secondary context (cid %u, primary cid %u)", cid, p_cid); + mm_obj_msg (self, "network request to activate secondary context (cid %u, primary cid %u)", cid, p_cid); break; case MM_3GPP_CGEV_ME_ACT_SECONDARY: - mm_obj_info (self, "mobile equipment request to activate secondary context (cid %u, primary cid %u)", cid, p_cid); + mm_obj_msg (self, "mobile equipment request to activate secondary context (cid %u, primary cid %u)", cid, p_cid); break; case MM_3GPP_CGEV_NW_DEACT_SECONDARY: - mm_obj_info (self, "network request to deactivate secondary context (cid %u, primary cid %u)", cid, p_cid); + mm_obj_msg (self, "network request to deactivate secondary context (cid %u, primary cid %u)", cid, p_cid); bearer_list_report_disconnections (self, (gint)cid); break; case MM_3GPP_CGEV_ME_DEACT_SECONDARY: - mm_obj_info (self, "mobile equipment request to deactivate secondary context (cid %u, primary cid %u)", cid, p_cid); + mm_obj_msg (self, "mobile equipment request to deactivate secondary context (cid %u, primary cid %u)", cid, p_cid); bearer_list_report_disconnections (self, (gint)cid); break; case MM_3GPP_CGEV_UNKNOWN: @@ -3066,28 +3066,28 @@ cgev_process_pdp (MMBroadbandModem *self, switch (type) { case MM_3GPP_CGEV_REJECT: - mm_obj_info (self, "network request to activate context (type %s, address %s) has been automatically rejected", pdp_type, pdp_addr); + mm_obj_msg (self, "network request to activate context (type %s, address %s) has been automatically rejected", pdp_type, pdp_addr); break; case MM_3GPP_CGEV_NW_REACT: /* NOTE: we don't currently notify about automatic reconnections like this one */ if (cid) - mm_obj_info (self, "network request to reactivate context (type %s, address %s, cid %u)", pdp_type, pdp_addr, cid); + mm_obj_msg (self, "network request to reactivate context (type %s, address %s, cid %u)", pdp_type, pdp_addr, cid); else - mm_obj_info (self, "network request to reactivate context (type %s, address %s, cid unknown)", pdp_type, pdp_addr); + mm_obj_msg (self, "network request to reactivate context (type %s, address %s, cid unknown)", pdp_type, pdp_addr); break; case MM_3GPP_CGEV_NW_DEACT_PDP: if (cid) { - mm_obj_info (self, "network request to deactivate context (type %s, address %s, cid %u)", pdp_type, pdp_addr, cid); + mm_obj_msg (self, "network request to deactivate context (type %s, address %s, cid %u)", pdp_type, pdp_addr, cid); bearer_list_report_disconnections (self, (gint)cid); } else - mm_obj_info (self, "network request to deactivate context (type %s, address %s, cid unknown)", pdp_type, pdp_addr); + mm_obj_msg (self, "network request to deactivate context (type %s, address %s, cid unknown)", pdp_type, pdp_addr); break; case MM_3GPP_CGEV_ME_DEACT_PDP: if (cid) { - mm_obj_info (self, "mobile equipment request to deactivate context (type %s, address %s, cid %u)", pdp_type, pdp_addr, cid); + mm_obj_msg (self, "mobile equipment request to deactivate context (type %s, address %s, cid %u)", pdp_type, pdp_addr, cid); bearer_list_report_disconnections (self, (gint)cid); } else - mm_obj_info (self, "mobile equipment request to deactivate context (type %s, address %s, cid unknown)", pdp_type, pdp_addr); + mm_obj_msg (self, "mobile equipment request to deactivate context (type %s, address %s, cid unknown)", pdp_type, pdp_addr); break; case MM_3GPP_CGEV_UNKNOWN: case MM_3GPP_CGEV_NW_DETACH: @@ -4200,8 +4200,8 @@ complete_sim_swap_check (GTask *task, g_assert_not_reached(); if (g_strcmp0 (current, cached) != 0) { - mm_obj_info (self, "SIM %s has changed: %s -> %s", - str, cached ? cached : "", current ? current : ""); + mm_obj_msg (self, "SIM %s has changed: %s -> %s", + str, cached ? cached : "", current ? current : ""); mm_iface_modem_process_sim_event (MM_IFACE_MODEM (self)); ctx->step = SIM_SWAP_CHECK_STEP_LAST; } else { @@ -4375,7 +4375,7 @@ modem_check_for_sim_swap (MMIfaceModem *self, NULL); if (modem_state == MM_MODEM_STATE_FAILED) { - mm_obj_info (self, "new SIM detected, handle as SIM hot-swap"); + mm_obj_msg (self, "new SIM detected, handle as SIM hot-swap"); mm_iface_modem_process_sim_event (MM_IFACE_MODEM (self)); g_task_return_boolean (task, TRUE); } else { @@ -12246,8 +12246,8 @@ syncing_step (GTask *task) g_object_unref (task); return; } - mm_obj_info (self, "resume synchronization state (%d/%d): modem interface sync", - ctx->step, SYNCING_STEP_LAST); + mm_obj_msg (self, "resume synchronization state (%d/%d): modem interface sync", + ctx->step, SYNCING_STEP_LAST); mm_iface_modem_sync (MM_IFACE_MODEM (self), (GAsyncReadyCallback)iface_modem_sync_ready, task); @@ -12261,8 +12261,8 @@ syncing_step (GTask *task) */ if (self->priv->modem_3gpp_dbus_skeleton && (self->priv->modem_state >= MM_MODEM_STATE_ENABLED)) { - mm_obj_info (self, "resume synchronization state (%d/%d): 3GPP interface sync", - ctx->step, SYNCING_STEP_LAST); + mm_obj_msg (self, "resume synchronization state (%d/%d): 3GPP interface sync", + ctx->step, SYNCING_STEP_LAST); mm_iface_modem_3gpp_sync (MM_IFACE_MODEM_3GPP (self), (GAsyncReadyCallback)iface_modem_3gpp_sync_ready, task); return; } @@ -12273,8 +12273,8 @@ syncing_step (GTask *task) /* Start Time interface synchronization, only if modem was enabled */ if (self->priv->modem_time_dbus_skeleton && (self->priv->modem_state >= MM_MODEM_STATE_ENABLED)) { - mm_obj_info (self, "resume synchronization state (%d/%d): time interface sync", - ctx->step, SYNCING_STEP_LAST); + mm_obj_msg (self, "resume synchronization state (%d/%d): time interface sync", + ctx->step, SYNCING_STEP_LAST); mm_iface_modem_time_sync (MM_IFACE_MODEM_TIME (self), (GAsyncReadyCallback)iface_modem_time_sync_ready, task); return; } @@ -12282,8 +12282,8 @@ syncing_step (GTask *task) /* fall through */ case SYNCING_STEP_LAST: - mm_obj_info (self, "resume synchronization state (%d/%d): all done", - ctx->step, SYNCING_STEP_LAST); + mm_obj_msg (self, "resume synchronization state (%d/%d): all done", + ctx->step, SYNCING_STEP_LAST); /* We are done without errors! */ g_task_return_boolean (task, TRUE); g_object_unref (task); diff --git a/src/mm-device.c b/src/mm-device.c index c2946bd9..83b1ed16 100644 --- a/src/mm-device.c +++ b/src/mm-device.c @@ -490,9 +490,9 @@ mm_device_create_modem (MMDevice *self, return FALSE; } - mm_obj_info (self, "creating modem with plugin '%s' and '%u' ports", - mm_plugin_get_name (self->priv->plugin), - g_list_length (self->priv->port_probes)); + mm_obj_msg (self, "creating modem with plugin '%s' and '%u' ports", + mm_plugin_get_name (self->priv->plugin), + g_list_length (self->priv->port_probes)); } else { if (!self->priv->virtual_ports) { g_set_error (error, @@ -502,9 +502,9 @@ mm_device_create_modem (MMDevice *self, return FALSE; } - mm_obj_info (self, "creating virtual modem with plugin '%s' and '%u' ports", - mm_plugin_get_name (self->priv->plugin), - g_strv_length (self->priv->virtual_ports)); + mm_obj_msg (self, "creating virtual modem with plugin '%s' and '%u' ports", + mm_plugin_get_name (self->priv->plugin), + g_strv_length (self->priv->virtual_ports)); } self->priv->modem = mm_plugin_create_modem (self->priv->plugin, self, error); diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index c7904f67..cb68bdf4 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -1986,8 +1986,8 @@ update_registration_reload_current_registration_info_ready (MMIfaceModem3gpp *se new_state = GPOINTER_TO_UINT (user_data); - mm_obj_info (self, "3GPP registration state changed (registering -> %s)", - mm_modem_3gpp_registration_state_get_string (new_state)); + mm_obj_msg (self, "3GPP registration state changed (registering -> %s)", + mm_modem_3gpp_registration_state_get_string (new_state)); mm_obj_dbg (self, "consolidated registration state: cs '%s', ps '%s', eps '%s', 5gs '%s' --> '%s'", mm_modem_3gpp_registration_state_get_string (priv->state_cs), mm_modem_3gpp_registration_state_get_string (priv->state_ps), @@ -2075,8 +2075,8 @@ update_registration_state (MMIfaceModem3gpp *self, return; } - mm_obj_info (self, "3GPP registration state changed (%s -> registering)", - mm_modem_3gpp_registration_state_get_string (old_state)); + mm_obj_msg (self, "3GPP registration state changed (%s -> registering)", + mm_modem_3gpp_registration_state_get_string (old_state)); /* Reload current registration info. ONLY update the state to REGISTERED * after having loaded operator code/name/subscription state */ @@ -2088,9 +2088,9 @@ update_registration_state (MMIfaceModem3gpp *self, return; } - mm_obj_info (self, "3GPP registration state changed (%s -> %s)", - mm_modem_3gpp_registration_state_get_string (old_state), - mm_modem_3gpp_registration_state_get_string (new_state)); + mm_obj_msg (self, "3GPP registration state changed (%s -> %s)", + mm_modem_3gpp_registration_state_get_string (old_state), + mm_modem_3gpp_registration_state_get_string (new_state)); mm_obj_dbg (self, "consolidated registration state: cs '%s', ps '%s', eps '%s', 5gs '%s' --> '%s'", mm_modem_3gpp_registration_state_get_string (priv->state_cs), mm_modem_3gpp_registration_state_get_string (priv->state_ps), diff --git a/src/mm-iface-modem-oma.c b/src/mm-iface-modem-oma.c index cc796b88..e27ee22f 100644 --- a/src/mm-iface-modem-oma.c +++ b/src/mm-iface-modem-oma.c @@ -124,9 +124,9 @@ mm_iface_modem_oma_update_session_state (MMIfaceModemOma *self, old_session_state = mm_gdbus_modem_oma_get_session_state (skeleton); if (old_session_state != new_session_state) { - mm_obj_info (self, "OMA session state changed (%s -> %s)", - mm_oma_session_state_get_string (old_session_state), - mm_oma_session_state_get_string (new_session_state)); + mm_obj_msg (self, "OMA session state changed (%s -> %s)", + mm_oma_session_state_get_string (old_session_state), + mm_oma_session_state_get_string (new_session_state)); /* Flush current change before signaling the state change, * so that clients get the proper state already in the diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index d4490f23..6b235e47 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -557,8 +557,8 @@ connection_step (ConnectionContext *ctx) /* fall through */ case CONNECTION_STEP_UNLOCK_CHECK: - mm_obj_info (ctx->self, "simple connect state (%d/%d): unlock check", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): unlock check", + ctx->step, CONNECTION_STEP_LAST); mm_iface_modem_update_lock_info (MM_IFACE_MODEM (ctx->self), MM_MODEM_LOCK_UNKNOWN, /* ask */ (GAsyncReadyCallback)update_lock_info_ready, @@ -566,8 +566,8 @@ connection_step (ConnectionContext *ctx) return; case CONNECTION_STEP_WAIT_FOR_INITIALIZED: - mm_obj_info (ctx->self, "simple connect state (%d/%d): wait to get fully initialized", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): wait to get fully initialized", + ctx->step, CONNECTION_STEP_LAST); mm_iface_modem_wait_for_final_state (MM_IFACE_MODEM (ctx->self), MM_MODEM_STATE_DISABLED, /* disabled == initialized */ (GAsyncReadyCallback)wait_for_initialized_ready, @@ -575,16 +575,16 @@ connection_step (ConnectionContext *ctx) return; case CONNECTION_STEP_ENABLE: - mm_obj_info (ctx->self, "simple connect state (%d/%d): enable", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): enable", + ctx->step, CONNECTION_STEP_LAST); mm_base_modem_enable (MM_BASE_MODEM (ctx->self), (GAsyncReadyCallback)enable_ready, ctx); return; case CONNECTION_STEP_WAIT_FOR_ENABLED: - mm_obj_info (ctx->self, "simple connect state (%d/%d): wait to get fully enabled", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): wait to get fully enabled", + ctx->step, CONNECTION_STEP_LAST); mm_iface_modem_wait_for_final_state (MM_IFACE_MODEM (ctx->self), MM_MODEM_STATE_UNKNOWN, /* just a final state */ (GAsyncReadyCallback)wait_for_enabled_ready, @@ -592,8 +592,8 @@ connection_step (ConnectionContext *ctx) return; case CONNECTION_STEP_WAIT_AFTER_ENABLED: - mm_obj_info (ctx->self, "simple connect state (%d/%d): wait after enabled", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): wait after enabled", + ctx->step, CONNECTION_STEP_LAST); /* When we have just enabled, we want to give it some time before starting * the registration process, so that any pending registration update that may * have been scheduled during the enabling phase is applied. We don't want to @@ -603,8 +603,8 @@ connection_step (ConnectionContext *ctx) case CONNECTION_STEP_REGISTER: - mm_obj_info (ctx->self, "simple connect state (%d/%d): register", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): register", + ctx->step, CONNECTION_STEP_LAST); if (mm_iface_modem_is_3gpp (MM_IFACE_MODEM (ctx->self)) || mm_iface_modem_is_cdma (MM_IFACE_MODEM (ctx->self))) { /* 3GPP or CDMA registration */ @@ -622,8 +622,8 @@ connection_step (ConnectionContext *ctx) /* fall through */ case CONNECTION_STEP_PACKET_SERVICE_ATTACH: - mm_obj_info (ctx->self, "simple connect state (%d/%d): wait to get packet service state attached", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): wait to get packet service state attached", + ctx->step, CONNECTION_STEP_LAST); if (mm_iface_modem_is_3gpp (MM_IFACE_MODEM (ctx->self))) { mm_iface_modem_3gpp_wait_for_packet_service_state (MM_IFACE_MODEM_3GPP (ctx->self), MM_MODEM_3GPP_PACKET_SERVICE_STATE_ATTACHED, @@ -638,8 +638,8 @@ connection_step (ConnectionContext *ctx) case CONNECTION_STEP_BEARER: { g_autoptr(MMBearerProperties) bearer_properties = NULL; - mm_obj_info (ctx->self, "simple connect state (%d/%d): bearer", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): bearer", + ctx->step, CONNECTION_STEP_LAST); bearer_properties = mm_simple_connect_properties_get_bearer_properties (ctx->properties); @@ -660,8 +660,8 @@ connection_step (ConnectionContext *ctx) } /* fall through */ case CONNECTION_STEP_CONNECT: - mm_obj_info (ctx->self, "simple connect state (%d/%d): connect", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): connect", + ctx->step, CONNECTION_STEP_LAST); /* At this point, we can cleanup the cancellation point in the Simple interface, * because the bearer connection has its own cancellation setup. */ @@ -683,8 +683,8 @@ connection_step (ConnectionContext *ctx) /* fall through */ case CONNECTION_STEP_LAST: - mm_obj_info (ctx->self, "simple connect state (%d/%d): all done", - ctx->step, CONNECTION_STEP_LAST); + mm_obj_msg (ctx->self, "simple connect state (%d/%d): all done", + ctx->step, CONNECTION_STEP_LAST); /* All done, yey! */ mm_gdbus_modem_simple_complete_connect ( ctx->skeleton, @@ -740,7 +740,7 @@ connect_auth_ready (MMBaseModem *self, return; } - mm_obj_info (self, "simple connect started..."); + mm_obj_msg (self, "simple connect started..."); /* Log about all the parameters being used for the simple connect */ { diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 911c139d..a267e8ca 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -1966,9 +1966,9 @@ update_state_internal (MMIfaceModem *self, /* Update state only if different */ if (new_state != old_state) { - mm_obj_info (self, "state changed (%s -> %s)", - mm_modem_state_get_string (old_state), - mm_modem_state_get_string (new_state)); + mm_obj_msg (self, "state changed (%s -> %s)", + mm_modem_state_get_string (old_state), + mm_modem_state_get_string (new_state)); /* The property in the interface is bound to the property * in the skeleton, so just updating here is enough */ @@ -4170,7 +4170,7 @@ set_power_state_step (GTask *task) mm_gdbus_modem_set_power_state (ctx->skeleton, ctx->previous_real_power_state); g_task_return_error (task, g_steal_pointer (&ctx->saved_error)); } else { - mm_obj_info (self, "power state updated: %s", mm_modem_power_state_get_string (ctx->requested_power_state)); + mm_obj_msg (self, "power state updated: %s", mm_modem_power_state_get_string (ctx->requested_power_state)); mm_gdbus_modem_set_power_state (ctx->skeleton, ctx->requested_power_state); g_task_return_boolean (task, TRUE); } diff --git a/src/mm-log.c b/src/mm-log.c index 26260b7c..e8a058c1 100644 --- a/src/mm-log.c +++ b/src/mm-log.c @@ -52,7 +52,7 @@ enum { }; static gboolean ts_flags = TS_FLAG_NONE; -static guint32 log_level = MM_LOG_LEVEL_INFO | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR; +static guint32 log_level = MM_LOG_LEVEL_MSG | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR; static GTimeVal rel_start = { 0, 0 }; static int logfd = -1; static gboolean append_log_level_text = TRUE; @@ -71,8 +71,10 @@ typedef struct { static const LogDesc level_descs[] = { { MM_LOG_LEVEL_ERR, "ERR" }, { MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR, "WARN" }, - { MM_LOG_LEVEL_INFO | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR, "INFO" }, - { MM_LOG_LEVEL_DEBUG | MM_LOG_LEVEL_INFO | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR, "DEBUG" }, + { MM_LOG_LEVEL_MSG | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR, "MSG" }, + { MM_LOG_LEVEL_INFO | MM_LOG_LEVEL_MSG | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR, "INFO" }, + { MM_LOG_LEVEL_DEBUG | MM_LOG_LEVEL_INFO | MM_LOG_LEVEL_MSG | MM_LOG_LEVEL_WARN | MM_LOG_LEVEL_ERR, "DEBUG" }, + { 0, NULL } }; static GString *msgbuf = NULL; @@ -86,6 +88,8 @@ mm_to_syslog_priority (MMLogLevel level) return LOG_ERR; case MM_LOG_LEVEL_WARN: return LOG_WARNING; + case MM_LOG_LEVEL_MSG: + return LOG_NOTICE; case MM_LOG_LEVEL_INFO: return LOG_INFO; case MM_LOG_LEVEL_DEBUG: @@ -112,6 +116,7 @@ glib_level_to_mm_level (GLogLevelFlags level) case G_LOG_LEVEL_WARNING: return MM_LOG_LEVEL_WARN; case G_LOG_LEVEL_MESSAGE: + return MM_LOG_LEVEL_MSG; case G_LOG_LEVEL_INFO: return MM_LOG_LEVEL_INFO; case G_LOG_LEVEL_DEBUG: @@ -132,6 +137,8 @@ log_level_description (MMLogLevel level) return ""; case MM_LOG_LEVEL_WARN: return " "; + case MM_LOG_LEVEL_MSG: + return " "; case MM_LOG_LEVEL_INFO: return " "; case MM_LOG_LEVEL_DEBUG: diff --git a/src/mm-log.h b/src/mm-log.h index 7eeee89d..4055718d 100644 --- a/src/mm-log.h +++ b/src/mm-log.h @@ -24,8 +24,9 @@ typedef enum { MM_LOG_LEVEL_ERR = 0x00000001, MM_LOG_LEVEL_WARN = 0x00000002, - MM_LOG_LEVEL_INFO = 0x00000004, - MM_LOG_LEVEL_DEBUG = 0x00000008, + MM_LOG_LEVEL_MSG = 0x00000004, + MM_LOG_LEVEL_INFO = 0x00000008, + MM_LOG_LEVEL_DEBUG = 0x00000010, } MMLogLevel; #if !defined MM_MODULE_NAME @@ -34,6 +35,7 @@ typedef enum { #define mm_obj_err(obj, ...) _mm_log (obj, MM_MODULE_NAME, G_STRLOC, G_STRFUNC, MM_LOG_LEVEL_ERR, ## __VA_ARGS__ ) #define mm_obj_warn(obj, ...) _mm_log (obj, MM_MODULE_NAME, G_STRLOC, G_STRFUNC, MM_LOG_LEVEL_WARN, ## __VA_ARGS__ ) +#define mm_obj_msg(obj, ...) _mm_log (obj, MM_MODULE_NAME, G_STRLOC, G_STRFUNC, MM_LOG_LEVEL_MSG, ## __VA_ARGS__ ) #define mm_obj_info(obj, ...) _mm_log (obj, MM_MODULE_NAME, G_STRLOC, G_STRFUNC, MM_LOG_LEVEL_INFO, ## __VA_ARGS__ ) #define mm_obj_dbg(obj, ...) _mm_log (obj, MM_MODULE_NAME, G_STRLOC, G_STRFUNC, MM_LOG_LEVEL_DEBUG, ## __VA_ARGS__ ) @@ -42,6 +44,7 @@ typedef enum { #if defined MM_LOG_NO_OBJECT # define mm_err(...) mm_obj_err (NULL, ## __VA_ARGS__ ) # define mm_warn(...) mm_obj_warn (NULL, ## __VA_ARGS__ ) +# define mm_msg(...) mm_obj_msg (NULL, ## __VA_ARGS__ ) # define mm_info(...) mm_obj_info (NULL, ## __VA_ARGS__ ) # define mm_dbg(...) mm_obj_dbg (NULL, ## __VA_ARGS__ ) #endif diff --git a/src/mm-port-mbim.c b/src/mm-port-mbim.c index 5748c15c..7dcdda59 100644 --- a/src/mm-port-mbim.c +++ b/src/mm-port-mbim.c @@ -451,10 +451,10 @@ qmi_device_open_ready (QmiDevice *dev, g_error_free (error); g_clear_object (&self->priv->qmi_device); /* Ignore error and complete */ - mm_obj_info (self, "MBIM device is not QMI capable"); + mm_obj_msg (self, "MBIM device is not QMI capable"); self->priv->qmi_supported = FALSE; } else { - mm_obj_info (self, "MBIM device is QMI capable"); + mm_obj_msg (self, "MBIM device is QMI capable"); } self->priv->in_progress = FALSE; @@ -477,7 +477,7 @@ qmi_device_new_ready (GObject *unused, mm_obj_dbg (self, "error: couldn't create QmiDevice: %s", error->message); g_error_free (error); /* Ignore error and complete */ - mm_obj_info (self, "MBIM device is not QMI capable"); + mm_obj_msg (self, "MBIM device is not QMI capable"); self->priv->qmi_supported = FALSE; self->priv->in_progress = FALSE; g_task_return_boolean (task, TRUE); @@ -546,7 +546,7 @@ mbim_query_device_services_ready (MbimDevice *device, file = G_FILE (g_task_get_task_data (task)); if (!file || !self->priv->qmi_supported) { - mm_obj_info (self, "MBIM device is not QMI capable"); + mm_obj_msg (self, "MBIM device is not QMI capable"); self->priv->in_progress = FALSE; g_task_return_boolean (task, TRUE); g_object_unref (task); diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c index b4001c9a..41f6033d 100644 --- a/src/mm-port-qmi.c +++ b/src/mm-port-qmi.c @@ -2397,7 +2397,7 @@ port_open_step (GTask *task) #if defined WITH_QRTR if (self->priv->node) { - mm_obj_info (self, "Creating QMI device from QRTR node..."); + mm_obj_dbg (self, "Creating QMI device from QRTR node..."); qmi_device_new_from_node (self->priv->node, g_task_get_cancellable (task), (GAsyncReadyCallback) qmi_device_new_ready, diff --git a/src/mm-qrtr-bus-watcher.c b/src/mm-qrtr-bus-watcher.c index ee0cb28b..de7e6ddf 100644 --- a/src/mm-qrtr-bus-watcher.c +++ b/src/mm-qrtr-bus-watcher.c @@ -83,7 +83,7 @@ qrtr_node_services_ready (QrtrNode *node, return; } - mm_obj_info (ctx->self, "qrtr services ready for node %u", node_id); + mm_obj_dbg (ctx->self, "qrtr services ready for node %u", node_id); g_signal_emit (ctx->self, signals[QRTR_DEVICE_ADDED], 0, node_id); device_context_free (ctx); } @@ -152,7 +152,7 @@ handle_qrtr_node_removed (QrtrBus *qrtr_bus, } g_hash_table_remove (self->priv->nodes, GUINT_TO_POINTER (node_id)); - mm_obj_info (self, "qrtr node %u removed", node_id); + mm_obj_dbg (self, "qrtr node %u removed", node_id); g_signal_emit (self, signals[QRTR_DEVICE_REMOVED], 0, node_id); } diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c index 30913123..a98352ef 100644 --- a/src/mm-shared-qmi.c +++ b/src/mm-shared-qmi.c @@ -2141,7 +2141,7 @@ reset_set_operating_mode_reset_ready (QmiClientDms *client, if (!output || !qmi_message_dms_set_operating_mode_output_get_result (output, &error)) { g_task_return_error (task, error); } else { - mm_obj_info (self, "rebooting now"); + mm_obj_msg (self, "rebooting now"); g_task_return_boolean (task, TRUE); } @@ -2632,8 +2632,8 @@ find_requested_carrier_config (GTask *task) g_assert (config_fallback_i >= 0); config = &g_array_index (priv->config_list, ConfigInfo, config_fallback_i); - mm_obj_info (self, "using fallback carrier configuration '%s' (version 0x%08x, size %u bytes)", - config->description, config->version, config->total_size); + mm_obj_dbg (self, "using fallback carrier configuration '%s' (version 0x%08x, size %u bytes)", + config->description, config->version, config->total_size); g_free (ctx->config_requested); ctx->config_requested = config_fallback; @@ -2679,7 +2679,7 @@ setup_carrier_config_step (GTask *task) g_assert (ctx->config_requested_i >= 0); g_assert (priv->config_active_i >= 0 || priv->config_active_default); if (ctx->config_requested_i == priv->config_active_i) { - mm_obj_info (self, "carrier config switching not needed: already using '%s'", ctx->config_requested); + mm_obj_msg (self, "carrier config switching not needed: already using '%s'", ctx->config_requested); ctx->step = SETUP_CARRIER_CONFIG_STEP_LAST; setup_carrier_config_step (task); return; @@ -3490,7 +3490,7 @@ uim_switch_slot_ready (QmiClientUim *client, else g_task_return_error (task, g_steal_pointer (&error)); } else { - mm_obj_info (self, "SIM slot switch operation request successful"); + mm_obj_msg (self, "SIM slot switch operation request successful"); g_task_return_boolean (task, TRUE); } g_object_unref (task); @@ -6891,8 +6891,8 @@ inject_xtra_data_next (GTask *task) ctx->i += count; - mm_obj_info (self, "injecting xtra data: %" G_GSIZE_FORMAT " bytes (%u/%u)", - count, (guint) ctx->n_part, (guint) ctx->total_parts); + mm_obj_dbg (self, "injecting xtra data: %" G_GSIZE_FORMAT " bytes (%u/%u)", + count, (guint) ctx->n_part, (guint) ctx->total_parts); qmi_client_loc_inject_xtra_data (ctx->client, input, 10, @@ -7044,8 +7044,8 @@ inject_assistance_data_next (GTask *task) ctx->i += count; - mm_obj_info (self, "injecting predicted orbits data: %" G_GSIZE_FORMAT " bytes (%u/%u)", - count, (guint) ctx->n_part, (guint) ctx->total_parts); + mm_obj_dbg (self, "injecting predicted orbits data: %" G_GSIZE_FORMAT " bytes (%u/%u)", + count, (guint) ctx->n_part, (guint) ctx->total_parts); qmi_client_loc_inject_predicted_orbits_data (ctx->client, input, 10, diff --git a/src/mm-sleep-monitor-powerd.c b/src/mm-sleep-monitor-powerd.c index 8f2d7ada..093b9deb 100644 --- a/src/mm-sleep-monitor-powerd.c +++ b/src/mm-sleep-monitor-powerd.c @@ -81,10 +81,10 @@ signal_cb (GDBusProxy *proxy, if (proxy == self->pd_proxy) { if (strcmp (signalname, "SuspendImminent") == 0) { - mm_obj_info (self, "system suspend signal from powerd"); + mm_obj_msg (self, "system suspend signal from powerd"); g_signal_emit (self, signals[SLEEPING], 0); } else if (strcmp (signalname, "SuspendDone") == 0) { - mm_obj_info (self, "system resume signal from powerd"); + mm_obj_msg (self, "system resume signal from powerd"); g_signal_emit (self, signals[RESUMING], 0); } } diff --git a/src/mm-sleep-monitor-systemd.c b/src/mm-sleep-monitor-systemd.c index a65aac42..99814386 100644 --- a/src/mm-sleep-monitor-systemd.c +++ b/src/mm-sleep-monitor-systemd.c @@ -148,11 +148,11 @@ signal_cb (GDBusProxy *proxy, g_variant_get (args, "(b)", &is_about_to_suspend); if (is_about_to_suspend) { - mm_obj_info (self, "system is about to suspend"); + mm_obj_msg (self, "system is about to suspend"); g_signal_emit (self, signals[SLEEPING], 0); drop_inhibitor (self); } else { - mm_obj_info (self, "system is resuming"); + mm_obj_msg (self, "system is resuming"); take_inhibitor (self); g_signal_emit (self, signals[RESUMING], 0); } diff --git a/tools/tests/test-stub.c b/tools/tests/test-stub.c index b88b2a34..fa702290 100644 --- a/tools/tests/test-stub.c +++ b/tools/tests/test-stub.c @@ -105,7 +105,7 @@ static void run_loop_for_ms (TestData *tdata, guint32 timeout) { - mm_info ("Run loop for %u ms", timeout); + mm_msg ("Run loop for %u ms", timeout); tdata->timeout_id = g_timeout_add (timeout, loop_timeout_cb, tdata); g_main_loop_run (tdata->loop); } @@ -117,7 +117,7 @@ stop_loop (TestData *tdata) g_source_remove (tdata->timeout_id); tdata->timeout_id = 0; } - mm_info ("Stop the loop"); + mm_msg ("Stop the loop"); g_main_loop_quit (tdata->loop); } @@ -133,7 +133,7 @@ add_modem_completion_cb (GObject *source_object, tdata = (TestData*)user_data; - mm_info ("AddModem DBus call completed"); + mm_msg ("AddModem DBus call completed"); dbus_return = g_dbus_proxy_call_finish (tdata->mm_proxy, res, &error); g_assert_no_error (error); g_assert_nonnull (dbus_return); @@ -189,7 +189,7 @@ emit_state_changed_completion_cb (GObject *source_object, tdata = (TestData*)user_data; - mm_info ("EmitStateChanged DBus call completed"); + mm_msg ("EmitStateChanged DBus call completed"); dbus_return = g_dbus_proxy_call_finish (tdata->mm_proxy, res, &error); g_assert_no_error (error); g_assert_nonnull (dbus_return); @@ -277,7 +277,7 @@ set_modem_unlock_completion_cb (GObject *source_object, tdata = (TestData*)user_data; - mm_info ("org.freedesktop.DBus.Properties.Set DBus call completed"); + mm_msg ("org.freedesktop.DBus.Properties.Set DBus call completed"); dbus_return = g_dbus_proxy_call_finish (tdata->mm_modem_prop_proxy, res, &error); g_assert_no_error (error); g_assert_nonnull (dbus_return); @@ -368,7 +368,7 @@ mm_sim_send_pin_completion_cb (GObject *source_object, tdata = (TestData*)user_data; - mm_info("SendPin DBus method call completed"); + mm_msg ("SendPin DBus method call completed"); ret = mm_sim_send_pin_finish (tdata->sim, res, &error); if (tdata->pin_error) { g_assert_nonnull (error);