diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-09-15 16:19:04 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-09-16 18:27:36 +0200 |
commit | 47fd8a1e55cac0b0b45812e1dda826f38c264d1b (patch) | |
tree | a74b6beebb191787cb8bbbd9d120a17d6842d92f | |
parent | d5ae71c349d11a4995fcb49249b2dc12f511fdeb (diff) |
iface-modem-3gpp: fix reporting 'denied' registration state
If all CS/PS/EPS report 'denied', we should not report 'unknown' as
consolidated...
<debug> [1568556573.833928] building consolidated registration state: cs 'denied', ps 'denied', eps 'denied' --> 'unknown'
(cherry picked from commit 76b8c7d0bad41fe080a33ba26fdd949976080cc4)
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index cb5642cb..b8425696 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -123,9 +123,10 @@ get_registration_state_context (MMIfaceModem3gpp *self) state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME_CSFB_NOT_PREFERRED || \ state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING_CSFB_NOT_PREFERRED) -#define REG_STATE_IS_UNKNOWN_OR_IDLE(state) \ +#define REG_STATE_IS_UNKNOWN_OR_IDLE_OR_DENIED(state) \ (state == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN || \ - state == MM_MODEM_3GPP_REGISTRATION_STATE_IDLE) + state == MM_MODEM_3GPP_REGISTRATION_STATE_IDLE || \ + state == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED) static MMModem3gppRegistrationState get_consolidated_reg_state (RegistrationStateContext *ctx) @@ -161,23 +162,14 @@ get_consolidated_reg_state (RegistrationStateContext *ctx) goto out; } - /* If one state is DENIED and the others are UNKNOWN or IDLE, use DENIED */ - if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED && - REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->ps) && - REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->eps)) { - consolidated = ctx->cs; - goto out; - } - if (REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->cs) && - ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED && - REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->eps)) { - consolidated = ctx->ps; - goto out; - } - if (REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->cs) && - REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->ps) && - ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED) { - consolidated = ctx->eps; + /* If at least one state is DENIED and the others are UNKNOWN or IDLE, use DENIED */ + if ((ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED || + ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED || + ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED) && + REG_STATE_IS_UNKNOWN_OR_IDLE_OR_DENIED (ctx->cs) && + REG_STATE_IS_UNKNOWN_OR_IDLE_OR_DENIED (ctx->ps) && + REG_STATE_IS_UNKNOWN_OR_IDLE_OR_DENIED (ctx->eps)) { + consolidated = MM_MODEM_3GPP_REGISTRATION_STATE_DENIED; goto out; } @@ -219,7 +211,6 @@ get_consolidated_reg_state (RegistrationStateContext *ctx) goto out; } - out: mm_dbg ("building consolidated registration state: cs '%s', ps '%s', eps '%s' --> '%s'", mm_modem_3gpp_registration_state_get_string (ctx->cs), |