diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-base-call.c | 2 | ||||
-rw-r--r-- | src/mm-broadband-modem-mbim.c | 6 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 2 | ||||
-rw-r--r-- | src/mm-error-helpers.c | 25 | ||||
-rw-r--r-- | src/mm-error-helpers.h | 10 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 4 | ||||
-rw-r--r-- | src/mm-iface-modem-simple.c | 2 | ||||
-rw-r--r-- | src/mm-serial-parsers.c | 16 | ||||
-rw-r--r-- | src/mm-sim-mbim.c | 8 | ||||
-rw-r--r-- | src/tests/test-error-helpers.c | 2 |
10 files changed, 41 insertions, 36 deletions
diff --git a/src/mm-base-call.c b/src/mm-base-call.c index 792c6adb..149cfbd4 100644 --- a/src/mm-base-call.c +++ b/src/mm-base-call.c @@ -169,7 +169,7 @@ handle_start_ready (MMBaseCall *self, if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED)) { g_clear_error (&error); - error = mm_connection_error_for_code (MM_CONNECTION_ERROR_NO_DIALTONE); + error = mm_connection_error_for_code (MM_CONNECTION_ERROR_NO_DIALTONE, self); } /* Convert errors into call state updates */ diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c index bd2a0b3f..7ccf74b1 100644 --- a/src/mm-broadband-modem-mbim.c +++ b/src/mm-broadband-modem-mbim.c @@ -995,12 +995,12 @@ unlock_required_subscriber_ready_state_ready (MbimDevice *device, * The MC7710 may use this while the SIM is not ready yet. */ break; case MBIM_SUBSCRIBER_READY_STATE_BAD_SIM: - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG, self); break; case MBIM_SUBSCRIBER_READY_STATE_FAILURE: case MBIM_SUBSCRIBER_READY_STATE_NOT_ACTIVATED: default: - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_FAILURE); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_FAILURE, self); break; } } @@ -1020,7 +1020,7 @@ unlock_required_subscriber_ready_state_ready (MbimDevice *device, /* All retries consumed? issue error */ if (ctx->last_attempt) { if (ready_state == MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED) - g_task_return_error (task, mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED)); + g_task_return_error (task, mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED, self)); else g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Error waiting for SIM to get initialized"); diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index d2812051..143c736f 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -9682,7 +9682,7 @@ run_cdma_registration_checks_ready (MMBroadbandModem *self, mm_iface_modem_cdma_update_access_technologies ( MM_IFACE_MODEM_CDMA (self), MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT, self); g_task_return_error (task, error); g_object_unref (task); return; diff --git a/src/mm-error-helpers.c b/src/mm-error-helpers.c index 7ce32113..57486d8b 100644 --- a/src/mm-error-helpers.c +++ b/src/mm-error-helpers.c @@ -29,7 +29,8 @@ typedef struct { /* --- Connection errors --- */ GError * -mm_connection_error_for_code (MMConnectionError code) +mm_connection_error_for_code (MMConnectionError code, + gpointer log_object) { const gchar *msg; @@ -51,7 +52,7 @@ mm_connection_error_for_code (MMConnectionError code) break; default: - mm_dbg ("Invalid connection error code: %u", code); + mm_obj_dbg (log_object, "invalid connection error code: %u", code); /* uhm... make something up (yes, ok, lie!). */ code = MM_CONNECTION_ERROR_NO_CARRIER; msg = "No carrier"; @@ -149,7 +150,8 @@ static ErrorTable me_errors[] = { }; GError * -mm_mobile_equipment_error_for_code (MMMobileEquipmentError code) +mm_mobile_equipment_error_for_code (MMMobileEquipmentError code, + gpointer log_object) { guint i; @@ -162,14 +164,15 @@ mm_mobile_equipment_error_for_code (MMMobileEquipmentError code) } /* Not found? Then, default */ - mm_dbg ("Invalid mobile equipment error code: %u", (guint)code); + mm_obj_dbg (log_object, "invalid mobile equipment error code: %u", (guint)code); return g_error_new (MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN, "Unknown error"); } GError * -mm_mobile_equipment_error_for_string (const gchar *str) +mm_mobile_equipment_error_for_string (const gchar *str, + gpointer log_object) { MMMobileEquipmentError code = MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN; const gchar *msg = NULL; @@ -198,7 +201,7 @@ mm_mobile_equipment_error_for_string (const gchar *str) /* Not found? Then, default */ if (!msg) { - mm_dbg ("Invalid mobile equipment error string: '%s' (%s)", str, buf); + mm_obj_dbg (log_object, "invalid mobile equipment error string: '%s' (%s)", str, buf); code = MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN; msg = "Unknown error"; } @@ -236,7 +239,8 @@ static ErrorTable msg_errors[] = { }; GError * -mm_message_error_for_code (MMMessageError code) +mm_message_error_for_code (MMMessageError code, + gpointer log_object) { guint i; @@ -249,14 +253,15 @@ mm_message_error_for_code (MMMessageError code) } /* Not found? Then, default */ - mm_dbg ("Invalid message error code: %u", (guint)code); + mm_obj_dbg (log_object, "invalid message error code: %u", (guint)code); return g_error_new (MM_MESSAGE_ERROR, MM_MESSAGE_ERROR_UNKNOWN, "Unknown error"); } GError * -mm_message_error_for_string (const gchar *str) +mm_message_error_for_string (const gchar *str, + gpointer log_object) { MMMessageError code = MM_MESSAGE_ERROR_UNKNOWN; const gchar *msg = NULL; @@ -285,7 +290,7 @@ mm_message_error_for_string (const gchar *str) /* Not found? Then, default */ if (!msg) { - mm_dbg ("Invalid message error string: '%s' (%s)", str, buf); + mm_obj_dbg (log_object, "invalid message error string: '%s' (%s)", str, buf); code = MM_MESSAGE_ERROR_UNKNOWN; msg = "Unknown error"; } diff --git a/src/mm-error-helpers.h b/src/mm-error-helpers.h index 379afb24..e99d1662 100644 --- a/src/mm-error-helpers.h +++ b/src/mm-error-helpers.h @@ -23,10 +23,10 @@ #include <ModemManager.h> #include <libmm-glib.h> -GError *mm_connection_error_for_code (MMConnectionError code); -GError *mm_mobile_equipment_error_for_code (MMMobileEquipmentError code); -GError *mm_mobile_equipment_error_for_string (const gchar *str); -GError *mm_message_error_for_code (MMMessageError code); -GError *mm_message_error_for_string (const gchar *str); +GError *mm_connection_error_for_code (MMConnectionError code, gpointer log_object); +GError *mm_mobile_equipment_error_for_code (MMMobileEquipmentError code, gpointer log_object); +GError *mm_mobile_equipment_error_for_string (const gchar *str, gpointer log_object); +GError *mm_message_error_for_code (MMMessageError code, gpointer log_object); +GError *mm_message_error_for_string (const gchar *str, gpointer log_object); #endif /* MM_ERROR_HELPERS_H */ diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index fc8cdc79..cbd989f6 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -311,7 +311,7 @@ run_registration_checks_ready (MMIfaceModem3gpp *self, mm_obj_dbg (self, "registration denied"); register_in_network_context_complete_failed ( task, - mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_NOT_ALLOWED)); + mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_NOT_ALLOWED, self)); return; } @@ -333,7 +333,7 @@ run_registration_checks_ready (MMIfaceModem3gpp *self, mm_obj_dbg (self, "3GPP registration check timed out"); register_in_network_context_complete_failed ( task, - mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT)); + mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT, self)); return; } diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index 61ae662b..b0cf5e22 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -164,7 +164,7 @@ check_next_registration (GTask *task) /* No more tries of anything */ g_task_return_error ( task, - mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT)); + mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT, self)); g_object_unref (task); } diff --git a/src/mm-serial-parsers.c b/src/mm-serial-parsers.c index 62592455..b511302e 100644 --- a/src/mm-serial-parsers.c +++ b/src/mm-serial-parsers.c @@ -239,7 +239,7 @@ mm_serial_parser_v1_parse (gpointer data, if (found) { str = g_match_info_fetch (match_info, 1); g_assert (str); - local_error = mm_mobile_equipment_error_for_code (atoi (str)); + local_error = mm_mobile_equipment_error_for_code (atoi (str), log_object); goto done; } g_match_info_free (match_info); @@ -252,7 +252,7 @@ mm_serial_parser_v1_parse (gpointer data, if (found) { str = g_match_info_fetch (match_info, 1); g_assert (str); - local_error = mm_mobile_equipment_error_for_code (atoi (str)); + local_error = mm_mobile_equipment_error_for_code (atoi (str), log_object); goto done; } g_match_info_free (match_info); @@ -264,7 +264,7 @@ mm_serial_parser_v1_parse (gpointer data, if (found) { str = g_match_info_fetch (match_info, 1); g_assert (str); - local_error = mm_message_error_for_code (atoi (str)); + local_error = mm_message_error_for_code (atoi (str), log_object); goto done; } g_match_info_free (match_info); @@ -276,7 +276,7 @@ mm_serial_parser_v1_parse (gpointer data, if (found) { str = g_match_info_fetch (match_info, 1); g_assert (str); - local_error = mm_mobile_equipment_error_for_string (str); + local_error = mm_mobile_equipment_error_for_string (str, log_object); goto done; } g_match_info_free (match_info); @@ -288,7 +288,7 @@ mm_serial_parser_v1_parse (gpointer data, if (found) { str = g_match_info_fetch (match_info, 1); g_assert (str); - local_error = mm_message_error_for_string (str); + local_error = mm_message_error_for_string (str, log_object); goto done; } g_match_info_free (match_info); @@ -300,7 +300,7 @@ mm_serial_parser_v1_parse (gpointer data, if (found) { str = g_match_info_fetch (match_info, 1); g_assert (str); - local_error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN); + local_error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN, log_object); goto done; } g_match_info_free (match_info); @@ -310,7 +310,7 @@ mm_serial_parser_v1_parse (gpointer data, response->str, response->len, 0, 0, &match_info, NULL); if (found) { - local_error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN); + local_error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN, log_object); goto done; } g_match_info_free (match_info); @@ -338,7 +338,7 @@ mm_serial_parser_v1_parse (gpointer data, code = MM_CONNECTION_ERROR_NO_CARRIER; } - local_error = mm_connection_error_for_code (code); + local_error = mm_connection_error_for_code (code, log_object); goto done; } g_match_info_free (match_info); diff --git a/src/mm-sim-mbim.c b/src/mm-sim-mbim.c index d1fc145f..f48bb31d 100644 --- a/src/mm-sim-mbim.c +++ b/src/mm-sim-mbim.c @@ -382,10 +382,10 @@ pin_set_enter_ready (MbimDevice *device, /* Sending PIN failed, build a better error to report */ if (pin_type == MBIM_PIN_TYPE_PIN1 && pin_state == MBIM_PIN_STATE_LOCKED) { g_error_free (error); - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD, self); } else if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED) { g_error_free (error); - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_PUK); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_PUK, self); } } } @@ -480,9 +480,9 @@ puk_set_enter_ready (MbimDevice *device, if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED) { g_error_free (error); if (remaining_attempts == 0) - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG, self); else - error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD); + error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD, self); } } } diff --git a/src/tests/test-error-helpers.c b/src/tests/test-error-helpers.c index ff67ed80..ae2b8626 100644 --- a/src/tests/test-error-helpers.c +++ b/src/tests/test-error-helpers.c @@ -38,7 +38,7 @@ \ enum_value = g_enum_get_value (enum_class, i); \ if (enum_value) { \ - error = mm_## ERROR_SMALL ## _for_code ((MM##ERROR_CAMEL)i); \ + error = mm_## ERROR_SMALL ## _for_code ((MM##ERROR_CAMEL)i, NULL); \ g_assert_error (error, MM_ ## ERROR_CAPS, i); \ g_error_free (error); \ } \ |