[RFC PATCH] iface-modem: allow reset and factory reset operation in every state
Ben Chan
benchan at chromium.org
Tue Aug 27 12:21:34 PDT 2013
---
Hi Dan and Aleksander,
Is there a reason that we'd like to disallow modem reset/factory reset when the modem is in FAILED state (e.g. SIM missing). It seems like modems should always allow resetting themselves regardless whether the SIM is missing or locked.
Thanks,
Ben
src/mm-iface-modem.c | 50 +++++++++++---------------------------------------
1 file changed, 11 insertions(+), 39 deletions(-)
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 3a12a6a..c599050 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -1626,7 +1626,6 @@ handle_reset_auth_ready (MMBaseModem *self,
GAsyncResult *res,
HandleResetContext *ctx)
{
- MMModemState modem_state;
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
@@ -1646,20 +1645,6 @@ handle_reset_auth_ready (MMBaseModem *self,
return;
}
- modem_state = MM_MODEM_STATE_UNKNOWN;
- g_object_get (self,
- MM_IFACE_MODEM_STATE, &modem_state,
- NULL);
-
- if (modem_state < MM_MODEM_STATE_DISABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot reset modem: not initialized/unlocked yet");
- handle_reset_context_free (ctx);
- return;
- }
-
MM_IFACE_MODEM_GET_INTERFACE (self)->reset (MM_IFACE_MODEM (self),
(GAsyncReadyCallback)handle_reset_ready,
ctx);
@@ -1725,7 +1710,6 @@ handle_factory_reset_auth_ready (MMBaseModem *self,
GAsyncResult *res,
HandleFactoryResetContext *ctx)
{
- MMModemState modem_state;
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
@@ -1746,21 +1730,6 @@ handle_factory_reset_auth_ready (MMBaseModem *self,
return;
}
- modem_state = MM_MODEM_STATE_UNKNOWN;
- g_object_get (self,
- MM_IFACE_MODEM_STATE, &modem_state,
- NULL);
-
- if (modem_state < MM_MODEM_STATE_DISABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot reset the modem to factory defaults: "
- "not initialized/unlocked yet");
- handle_factory_reset_context_free (ctx);
- return;
- }
-
MM_IFACE_MODEM_GET_INTERFACE (self)->factory_reset (MM_IFACE_MODEM (self),
ctx->code,
(GAsyncReadyCallback)handle_factory_reset_ready,
@@ -4441,6 +4410,17 @@ interface_initialization_step (InitializationContext *ctx)
"handle-set-current-capabilities",
G_CALLBACK (handle_set_current_capabilities),
ctx->self);
+ /* Allow the reset and factory reset operation in FAILED state to rescue the modem.
+ * Also, for a modem that doesn't support SIM hot swapping, a reset is needed to
+ * force the modem to detect the newly inserted SIM. */
+ g_signal_connect (ctx->skeleton,
+ "handle-reset",
+ G_CALLBACK (handle_reset),
+ ctx->self);
+ g_signal_connect (ctx->skeleton,
+ "handle-factory-reset",
+ G_CALLBACK (handle_factory_reset),
+ ctx->self);
if (ctx->fatal_error) {
g_simple_async_result_take_error (ctx->result, ctx->fatal_error);
@@ -4473,14 +4453,6 @@ interface_initialization_step (InitializationContext *ctx)
G_CALLBACK (handle_set_power_state),
ctx->self);
g_signal_connect (ctx->skeleton,
- "handle-reset",
- G_CALLBACK (handle_reset),
- ctx->self);
- g_signal_connect (ctx->skeleton,
- "handle-factory-reset",
- G_CALLBACK (handle_factory_reset),
- ctx->self);
- g_signal_connect (ctx->skeleton,
"handle-set-current-bands",
G_CALLBACK (handle_set_current_bands),
ctx->self);
--
1.8.3.1
More information about the ModemManager-devel
mailing list