From 43e76bf1bbca8207e37d3fbddfed4bb8578f0170 Mon Sep 17 00:00:00 2001 From: Andrew Lassalle Date: Wed, 6 Oct 2021 17:07:49 -0700 Subject: 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. --- src/mm-iface-modem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 19eb2847..3806661c 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -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; } -- cgit v1.2.3-70-g09d2