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:
@@ -146,6 +146,7 @@ typedef enum { /*< underscore_name=mm_modem_state >*/
|
||||
* @MM_MODEM_STATE_FAILED_REASON_UNKNOWN: Unknown error.
|
||||
* @MM_MODEM_STATE_FAILED_REASON_SIM_MISSING: SIM is required but missing.
|
||||
* @MM_MODEM_STATE_FAILED_REASON_SIM_ERROR: SIM is available, but unusable (e.g. permanently locked).
|
||||
* @MM_MODEM_STATE_FAILED_REASON_UNKNOWN_CAPABILITIES: Unknown modem capabilities. Since 1.20.
|
||||
* @MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES: eSIM is not initialized. Since 1.20.
|
||||
*
|
||||
* Enumeration of possible errors when the modem is in @MM_MODEM_STATE_FAILED.
|
||||
@@ -157,7 +158,8 @@ typedef enum { /*< underscore_name=mm_modem_state_failed_reason >*/
|
||||
MM_MODEM_STATE_FAILED_REASON_UNKNOWN = 1,
|
||||
MM_MODEM_STATE_FAILED_REASON_SIM_MISSING = 2,
|
||||
MM_MODEM_STATE_FAILED_REASON_SIM_ERROR = 3,
|
||||
MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES = 4,
|
||||
MM_MODEM_STATE_FAILED_REASON_UNKNOWN_CAPABILITIES = 4,
|
||||
MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES = 5,
|
||||
} MMModemStateFailedReason;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user