[PATCH] iface-modem-3gpp: used DENIED registration state if others are UNKNOWN

Dan Williams dcbw at redhat.com
Mon Feb 23 08:35:02 PST 2015


If all other registration states are UNKNOWN, use a registration state
of DENIED as the modem registration state.
---
 src/mm-iface-modem-3gpp.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index 919954c..199b880 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -130,24 +130,34 @@ get_consolidated_reg_state (RegistrationStateContext *ctx)
     if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_HOME ||
         ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING)
         return ctx->cs;
-
     if (ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_HOME ||
         ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING)
         return ctx->ps;
-
     if (ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_HOME ||
         ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING)
         return ctx->eps;
 
     if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING)
         return ctx->cs;
-
     if (ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING)
         return ctx->ps;
-
     if (ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING)
         return ctx->eps;
 
+    /* If one state is DENIED and the others are UNKNOWN, 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)
+        return ctx->cs;
+    if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN &&
+        ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED &&
+        ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN)
+        return ctx->ps;
+    if (ctx->cs == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN &&
+        ctx->ps == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN &&
+        ctx->eps == MM_MODEM_3GPP_REGISTRATION_STATE_DENIED)
+        return ctx->eps;
+
     return ctx->cs;
 }
 
-- 
2.1.0




More information about the ModemManager-devel mailing list