aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2022-05-20 14:50:49 +0200
committerAleksander Morgado <aleksander@aleksander.es>2022-05-25 11:15:06 +0200
commit9c773fcad4dca0195000c293bedd1280629ed5e5 (patch)
treed76d7220d4e86a2c02558492d0dea278be2b009e /src
parente90a7410b40995a6e3c2ee88f8cbd1f94a4c803f (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c4
-rw-r--r--src/mm-iface-modem.c14
2 files changed, 12 insertions, 6 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 5c87caf2..3dde167e 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -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);
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 6b8b12cf..8ef45927 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -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);