[PATCH V2] altair-lte: early fail connect/disconnect attempts when out of coverage
Aleksander Morgado
aleksander at lanedo.com
Thu Nov 7 23:49:43 PST 2013
On 07/11/13 22:08, Prathmesh Prabhu wrote:
> A firmware bug in Altair ALT3100 bricks the modem when
> - The modem is out of coverage (Registration state is unknown (CEREG: 4))
> - A disconnect attempt is made using the AT%DPDNACT command.
>
> This patch prevents this situation by failing the connect/disconnect attempts in
> the altair plugin when registration state is unknown, without attempting to
> connect/disconnect the modem.
> ---
Pushed, thanks.
> plugins/altair/mm-broadband-bearer-altair-lte.c | 41 +++++++++++++++++++++++--
> 1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/plugins/altair/mm-broadband-bearer-altair-lte.c b/plugins/altair/mm-broadband-bearer-altair-lte.c
> index ca29b07..88cb46c 100644
> --- a/plugins/altair/mm-broadband-bearer-altair-lte.c
> +++ b/plugins/altair/mm-broadband-bearer-altair-lte.c
> @@ -29,6 +29,7 @@
>
> #include "mm-base-modem-at.h"
> #include "mm-broadband-bearer-altair-lte.h"
> +#include "mm-iface-modem-3gpp.h"
> #include "mm-log.h"
> #include "mm-modem-helpers.h"
>
> @@ -168,7 +169,7 @@ connect_3gpp_apnsettings_ready (MMBaseModem *modem,
> }
>
> static void
> -connect_3gpp (MMBroadbandBearer *bearer,
> +connect_3gpp (MMBroadbandBearer *self,
> MMBroadbandModem *modem,
> MMAtSerialPort *primary,
> MMAtSerialPort *secondary,
> @@ -179,9 +180,26 @@ connect_3gpp (MMBroadbandBearer *bearer,
> DetailedConnectContext *ctx;
> gchar *command, *apn;
> MMBearerProperties *config;
> + MMModem3gppRegistrationState registration_state;
> +
> + /* There is a known firmware bug that can leave the modem unusable if a
> + * connect attempt is made when out of coverage. So, fail without trying.
> + */
> + g_object_get (modem,
> + MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, ®istration_state,
> + NULL);
> + if (registration_state == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN) {
> + g_simple_async_report_error_in_idle (G_OBJECT (self),
> + callback,
> + user_data,
> + MM_MOBILE_EQUIPMENT_ERROR,
> + MM_MOBILE_EQUIPMENT_ERROR_NO_NETWORK,
> + "Out of coverage, can't connect.");
> + return;
> + }
>
> ctx = detailed_connect_context_new (
> - bearer,
> + self,
> modem,
> primary,
> /* Get a 'net' data port */
> @@ -201,7 +219,7 @@ connect_3gpp (MMBroadbandBearer *bearer,
> return;
> }
>
> - config = mm_bearer_peek_config (MM_BEARER (bearer));
> + config = mm_bearer_peek_config (MM_BEARER (self));
> apn = mm_at_serial_port_quote_string (mm_bearer_properties_get_apn (config));
> command = g_strdup_printf ("%%APNN=%s",apn);
> g_free (apn);
> @@ -306,6 +324,23 @@ disconnect_3gpp (MMBroadbandBearer *self,
> gpointer user_data)
> {
> DetailedDisconnectContext *ctx;
> + MMModem3gppRegistrationState registration_state;
> +
> + /* There is a known firmware bug that can leave the modem unusable if a
> + * disconnect attempt is made when out of coverage. So, fail without trying.
> + */
> + g_object_get (modem,
> + MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, ®istration_state,
> + NULL);
> + if (registration_state == MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN) {
> + g_simple_async_report_error_in_idle (G_OBJECT (self),
> + callback,
> + user_data,
> + MM_MOBILE_EQUIPMENT_ERROR,
> + MM_MOBILE_EQUIPMENT_ERROR_NO_NETWORK,
> + "Out of coverage, can't disconnect.");
> + return;
> + }
>
> ctx = detailed_disconnect_context_new (self, modem, primary, secondary,
> data, callback, user_data);
>
--
Aleksander
More information about the ModemManager-devel
mailing list