From 8430b051139cc4ca5711345f6244ca5cf160c7e6 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 6 Aug 2018 10:15:36 +0200 Subject: [PATCH] broadband-modem: allow Enable() if disabling or initializing The first step in the Enable() processing is to wait for a final state, so we can definitely wait for the ongoing disabling or initializing states to finish before we go on with the enable operation, there is no need to early fail if the disabling or initializing intermediate states are detected. --- src/mm-broadband-modem.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 8c083566..a4be504d 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -9969,12 +9969,10 @@ enable (MMBaseModem *self, break; case MM_MODEM_STATE_FAILED: - case MM_MODEM_STATE_INITIALIZING: g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE, - "Cannot enable modem: " - "device not fully initialized yet"); + "Cannot enable modem: initialization failed"); break; case MM_MODEM_STATE_LOCKED: @@ -9984,7 +9982,9 @@ enable (MMBaseModem *self, "Cannot enable modem: device locked"); break; - case MM_MODEM_STATE_DISABLED: { + case MM_MODEM_STATE_INITIALIZING: + case MM_MODEM_STATE_DISABLED: + case MM_MODEM_STATE_DISABLING: { EnablingContext *ctx; ctx = g_new0 (EnablingContext, 1); @@ -9997,14 +9997,6 @@ enable (MMBaseModem *self, return; } - case MM_MODEM_STATE_DISABLING: - g_task_return_new_error (task, - MM_CORE_ERROR, - MM_CORE_ERROR_WRONG_STATE, - "Cannot enable modem: " - "currently being disabled"); - break; - case MM_MODEM_STATE_ENABLING: g_assert_not_reached (); break;