diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-07-12 09:38:54 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2019-07-15 04:43:54 +0000 |
commit | 417c0ed882847f2258d2c07aa210b4ad2abc5ac5 (patch) | |
tree | c77587499e8af9cf8085a146a655cab3efc8cfc9 | |
parent | e9f5700d5f40f3a27f1563aaf4fbaecd3f585a19 (diff) |
iface-modem-3gpp: denied if all reg states idle except for one
If there is one registration state which is denied and the remaining
ones are either unknown or idle, then report denied.
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 5918907e..cb5642cb 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -123,6 +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) \ + (state == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN || \ + state == MM_MODEM_3GPP_REGISTRATION_STATE_IDLE) + static MMModem3gppRegistrationState get_consolidated_reg_state (RegistrationStateContext *ctx) { @@ -159,19 +163,19 @@ get_consolidated_reg_state (RegistrationStateContext *ctx) /* If 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_UNKNOWN && - ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN) { + REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->ps) && + REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->eps)) { consolidated = ctx->cs; goto out; } - if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN && + if (REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->cs) && ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED && - ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN) { + REG_STATE_IS_UNKNOWN_OR_IDLE (ctx->eps)) { consolidated = ctx->ps; goto out; } - if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN && - ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN && + 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; goto out; |