sim: update unlock retry counts after PIN change/enable operations
This commit is contained in:
57
src/mm-sim.c
57
src/mm-sim.c
@@ -158,6 +158,19 @@ handle_change_pin_context_free (HandleChangePinContext *ctx)
|
||||
g_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
after_change_unlock_retries_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
HandleChangePinContext *ctx)
|
||||
{
|
||||
/* We just want to ensure that we tried to update the unlock
|
||||
* retries, no big issue if it failed */
|
||||
mm_iface_modem_update_unlock_retries_finish (self, res, NULL);
|
||||
|
||||
mm_gdbus_sim_complete_change_pin (MM_GDBUS_SIM (ctx->self), ctx->invocation);
|
||||
handle_change_pin_context_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_change_pin_ready (MMSim *self,
|
||||
GAsyncResult *res,
|
||||
@@ -166,12 +179,17 @@ handle_change_pin_ready (MMSim *self,
|
||||
GError *error = NULL;
|
||||
|
||||
MM_SIM_GET_CLASS (self)->change_pin_finish (self, res, &error);
|
||||
if (error)
|
||||
if (error) {
|
||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
else
|
||||
mm_gdbus_sim_complete_change_pin (MM_GDBUS_SIM (ctx->self), ctx->invocation);
|
||||
handle_change_pin_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
handle_change_pin_context_free (ctx);
|
||||
/* Before returning success, ensure that we get the unlock retry
|
||||
* counts updated properly. */
|
||||
mm_iface_modem_update_unlock_retries (MM_IFACE_MODEM (self->priv->modem),
|
||||
(GAsyncReadyCallback)after_change_unlock_retries_ready,
|
||||
ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -308,6 +326,19 @@ handle_enable_pin_context_free (HandleEnablePinContext *ctx)
|
||||
g_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
after_enable_unlock_retries_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
HandleEnablePinContext *ctx)
|
||||
{
|
||||
/* We just want to ensure that we tried to update the unlock
|
||||
* retries, no big issue if it failed */
|
||||
mm_iface_modem_update_unlock_retries_finish (self, res, NULL);
|
||||
|
||||
mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (ctx->self), ctx->invocation);
|
||||
handle_enable_pin_context_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_enable_pin_ready (MMSim *self,
|
||||
GAsyncResult *res,
|
||||
@@ -316,16 +347,20 @@ handle_enable_pin_ready (MMSim *self,
|
||||
GError *error = NULL;
|
||||
|
||||
MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error);
|
||||
if (error)
|
||||
if (error) {
|
||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
else {
|
||||
mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (self), ctx->invocation);
|
||||
|
||||
/* Signal about the new lock state */
|
||||
g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled);
|
||||
handle_enable_pin_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
handle_enable_pin_context_free (ctx);
|
||||
/* Signal about the new lock state */
|
||||
g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled);
|
||||
|
||||
/* Before returning success, ensure that we get the unlock retry
|
||||
* counts updated properly. */
|
||||
mm_iface_modem_update_unlock_retries (MM_IFACE_MODEM (self->priv->modem),
|
||||
(GAsyncReadyCallback)after_enable_unlock_retries_ready,
|
||||
ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user