altair-lte: early fail connect/disconnect attempts when out of coverage
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.
This commit is contained in:

committed by
Aleksander Morgado

parent
3c6428fa58
commit
3d4c143b40
@@ -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);
|
||||
|
Reference in New Issue
Block a user