diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-09-15 16:19:04 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2019-09-16 14:22:12 +0000 |
commit | 76b8c7d0bad41fe080a33ba26fdd949976080cc4 (patch) | |
tree | 9d9b6b09539e858ac46a7eb7c5501e859823bbbc | |
parent | abede5b9e330f74ce5a2da2440d0630d551edc13 (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'
-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), |