iface-modem: report failed modems with unknown capabilities

Instead of not creating a modem object, create it in failed state with
the "unknown capabilities" failed state reason.
This commit is contained in:
Aleksander Morgado
2022-05-25 11:15:06 +02:00
parent e90a7410b4
commit 9c773fcad4
3 changed files with 15 additions and 7 deletions
+4
View File
@@ -12393,6 +12393,10 @@ iface_modem_initialize_ready (MMBroadbandModem *self,
MM_CORE_ERROR,
MM_CORE_ERROR_WRONG_SIM_STATE))
failed_reason = MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES;
else if (g_error_matches (error,
MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED))
failed_reason = MM_MODEM_STATE_FAILED_REASON_UNKNOWN_CAPABILITIES;
g_error_free (error);
+8 -6
View File
@@ -4833,14 +4833,15 @@ load_current_capabilities_ready (MMIfaceModem *self,
{
InitializationContext *ctx;
MMModemCapability caps;
GError *error = NULL;
g_autoptr(GError) error = NULL;
ctx = g_task_get_task_data (task);
caps = MM_IFACE_MODEM_GET_INTERFACE (self)->load_current_capabilities_finish (self, res, &error);
if (error) {
g_propagate_error (&ctx->fatal_error, error);
g_prefix_error (&ctx->fatal_error, "couldn't load current capabilities: ");
ctx->fatal_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
"Failed to load current capabilities: %s",
error->message);
/* Jump to the last step */
ctx->step = INITIALIZATION_STEP_LAST;
interface_initialization_step (task);
@@ -4904,14 +4905,15 @@ load_supported_capabilities_ready (MMIfaceModem *self,
{
InitializationContext *ctx;
GArray *supported_capabilities;
GError *error = NULL;
g_autoptr(GError) error = NULL;
ctx = g_task_get_task_data (task);
supported_capabilities = MM_IFACE_MODEM_GET_INTERFACE (self)->load_supported_capabilities_finish (self, res, &error);
if (error) {
g_propagate_error (&ctx->fatal_error, error);
g_prefix_error (&ctx->fatal_error, "couldn't load supported capabilities: ");
ctx->fatal_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
"Failed to load supported capabilities: %s",
error->message);
/* Jump to the last step */
ctx->step = INITIALIZATION_STEP_LAST;
interface_initialization_step (task);