iface-modem: Allow SetPowerState(Low|On) on failed state

In some modems, the modem's radio can be ON when no SIM card is present.
In this case, the modem is in failed state, and the host cannot set the
power state to LOW. Since we we will allow the host to set the power to
LOW, we should allow it to set it back to ON.
This commit is contained in:
Andrew Lassalle
2021-10-06 17:07:49 -07:00
parent 53f6c309bf
commit 43e76bf1bb

View File

@@ -2163,14 +2163,15 @@ handle_set_power_state_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
/* Going into LOW or ON only allowed in disabled state */
/* Going into LOW or ON only allowed in disabled and failed states */
if ((ctx->power_state == MM_MODEM_POWER_STATE_LOW ||
ctx->power_state == MM_MODEM_POWER_STATE_ON) &&
modem_state != MM_MODEM_STATE_FAILED &&
modem_state != MM_MODEM_STATE_DISABLED) {
g_dbus_method_invocation_return_error (ctx->invocation,
MM_CORE_ERROR,
MM_CORE_ERROR_WRONG_STATE,
"Cannot set power state: not in disabled state");
"Cannot set power state: not in disabled or failed state");
handle_set_power_state_context_free (ctx);
return;
}