On 03/05/2013 03:37 AM, Ben Chan wrote:
> This patch changes MMIfaceModem3gpp to differentiate between deferrable
> and non-deferrable 3GPP registration state updates. Periodic or
> unsolicited registration state updates are deferrable, while internal
> updates, e.g. due to modem being disabled, are non-deferrable.
> ---
> src/mm-iface-modem-3gpp.c | 40 ++++++++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 18 deletions(-)
Pushed after some minor modifications.
Thanks.
>
> diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
> index 6c8bb14..7049ec8 100644
> --- a/src/mm-iface-modem-3gpp.c
> +++ b/src/mm-iface-modem-3gpp.c
> @@ -1093,7 +1093,8 @@ run_deferred_registration_state_update
> (MMIfaceModem3gpp *self)
>
> static void
> update_registration_state (MMIfaceModem3gpp *self,
> - MMModem3gppRegistrationState new_state)
> + MMModem3gppRegistrationState new_state,
> + gboolean deferrable)
> {
> MMModem3gppRegistrationState old_state =
> MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN;
> RegistrationStateContext *ctx;
> @@ -1106,18 +1107,20 @@ update_registration_state (MMIfaceModem3gpp *self,
> g_assert (ctx);
>
> if (ctx->deferred_update_id != 0) {
> - /* If there is already a deferred 'registration loss' state update
> and the new update
> - * is not a registered state, update the deferred state update
> without extending the
> - * timeout. */
> - if (new_state != MM_MODEM_3GPP_REGISTRATION_STATE_HOME &&
> - new_state != MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) {
> - mm_info ("Modem %s: 3GPP Registration state changed (%s -> %s),
> update deferred",
> - g_dbus_object_get_object_path (G_DBUS_OBJECT (self)),
> - mm_modem_3gpp_registration_state_get_string (old_state),
> - mm_modem_3gpp_registration_state_get_string
> (new_state));
> -
> - ctx->deferred_new_state = new_state;
> - return;
> + if (deferrable) {
> + /* If there is already a deferred 'registration loss' state
> update and the new update
> + * is not a registered state, update the deferred state update
> without extending the
> + * timeout. */
> + if (new_state != MM_MODEM_3GPP_REGISTRATION_STATE_HOME &&
> + new_state != MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) {
> + mm_info ("Modem %s: 3GPP Registration state changed (%s ->
> %s), update deferred",
> + g_dbus_object_get_object_path (G_DBUS_OBJECT
> (self)),
> + mm_modem_3gpp_registration_state_get_string
> (old_state),
> + mm_modem_3gpp_registration_state_get_string
> (new_state));
> +
> + ctx->deferred_new_state = new_state;
> + return;
> + }
> }
>
> /* Otherwise, cancel any deferred registration state update */
> @@ -1153,7 +1156,8 @@ update_registration_state (MMIfaceModem3gpp *self,
> if ((old_state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME ||
> old_state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) &&
> (new_state == MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING ||
> - new_state == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN)) {
> + new_state == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN) &&
> + deferrable) {
> mm_info ("Modem %s: 3GPP Registration state changed (%s -> %s),
> update deferred",
> g_dbus_object_get_object_path (G_DBUS_OBJECT (self)),
> mm_modem_3gpp_registration_state_get_string (old_state),
> @@ -1191,7 +1195,7 @@ mm_iface_modem_3gpp_update_cs_registration_state
> (MMIfaceModem3gpp *self,
>
> ctx = get_registration_state_context (self);
> ctx->cs = state;
> - update_registration_state (self, get_consolidated_reg_state (ctx));
> + update_registration_state (self, get_consolidated_reg_state (ctx), TRUE);
> }
>
> void
> @@ -1210,7 +1214,7 @@ mm_iface_modem_3gpp_update_ps_registration_state
> (MMIfaceModem3gpp *self,
>
> ctx = get_registration_state_context (self);
> ctx->ps = state;
> - update_registration_state (self, get_consolidated_reg_state (ctx));
> + update_registration_state (self, get_consolidated_reg_state (ctx), TRUE);
> }
>
> void
> @@ -1229,7 +1233,7 @@ mm_iface_modem_3gpp_update_eps_registration_state
> (MMIfaceModem3gpp *self,
>
> ctx = get_registration_state_context (self);
> ctx->eps = state;
> - update_registration_state (self, get_consolidated_reg_state (ctx));
> + update_registration_state (self, get_consolidated_reg_state (ctx), TRUE);
> }
>
>
> /*****************************************************************************/
> @@ -1492,7 +1496,7 @@ interface_disabling_step (DisablingContext *ctx)
> ctx->step++;
>
> case DISABLING_STEP_REGISTRATION_STATE:
> - update_registration_state (ctx->self,
> MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN);
> + update_registration_state (ctx->self,
> MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN, FALSE);
> mm_iface_modem_3gpp_update_access_technologies (ctx->self,
> MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
> mm_iface_modem_3gpp_update_location (ctx->self, 0, 0);
> /* Fall down to next step */
>
--
Aleksander
_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list