altair-lte: explicitly use primary port for connection/disconnection sequence
The Altair LTE modem only uses its primary AT port for AT commands. Instead of referencing any existing secondary port, this patch changes MMBroadbandBearerAltairLte to explicitly use the primary port during the connection and disconnection sequence.
This commit is contained in:

committed by
Aleksander Morgado

parent
22b0de736b
commit
6c1c0d5e2b
@@ -110,7 +110,7 @@ connect_3gpp_connect_ready (MMBaseModem *modem,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
MMBearerIpConfig *config;
|
MMBearerIpConfig *config;
|
||||||
|
|
||||||
result = mm_base_modem_at_command_finish (modem, res, &error);
|
result = mm_base_modem_at_command_full_finish (modem, res, &error);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
mm_warn ("connect failed: %s", error->message);
|
mm_warn ("connect failed: %s", error->message);
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
@@ -145,7 +145,7 @@ connect_3gpp_apnsettings_ready (MMBaseModem *modem,
|
|||||||
const gchar *result;
|
const gchar *result;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
result = mm_base_modem_at_command_finish (modem, res, &error);
|
result = mm_base_modem_at_command_full_finish (modem, res, &error);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
mm_warn ("setting APN failed: %s", error->message);
|
mm_warn ("setting APN failed: %s", error->message);
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
@@ -154,13 +154,15 @@ connect_3gpp_apnsettings_ready (MMBaseModem *modem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mm_dbg ("APN set - connecting bearer");
|
mm_dbg ("APN set - connecting bearer");
|
||||||
mm_base_modem_at_command (
|
mm_base_modem_at_command_full (ctx->modem,
|
||||||
ctx->modem,
|
ctx->primary,
|
||||||
"%DPDNACT=1",
|
"%DPDNACT=1",
|
||||||
20, /* timeout */
|
20, /* timeout */
|
||||||
FALSE, /* allow_cached */
|
FALSE, /* allow_cached */
|
||||||
(GAsyncReadyCallback)connect_3gpp_connect_ready, /* callback */
|
FALSE, /* is_raw */
|
||||||
ctx); /* user_data */
|
ctx->cancellable,
|
||||||
|
(GAsyncReadyCallback)connect_3gpp_connect_ready,
|
||||||
|
ctx); /* user_data */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -217,13 +219,15 @@ connect_3gpp (MMBroadbandBearer *self,
|
|||||||
apn = mm_at_serial_port_quote_string (mm_bearer_properties_get_apn (config));
|
apn = mm_at_serial_port_quote_string (mm_bearer_properties_get_apn (config));
|
||||||
command = g_strdup_printf ("%%APNN=%s",apn);
|
command = g_strdup_printf ("%%APNN=%s",apn);
|
||||||
g_free (apn);
|
g_free (apn);
|
||||||
mm_base_modem_at_command (
|
mm_base_modem_at_command_full (ctx->modem,
|
||||||
ctx->modem,
|
ctx->primary,
|
||||||
command,
|
command,
|
||||||
10, /* timeout */
|
10, /* timeout */
|
||||||
FALSE, /* allow_cached */
|
FALSE, /* allow_cached */
|
||||||
(GAsyncReadyCallback)connect_3gpp_apnsettings_ready,
|
FALSE, /* is_raw */
|
||||||
ctx); /* user_data */
|
ctx->cancellable,
|
||||||
|
(GAsyncReadyCallback)connect_3gpp_apnsettings_ready,
|
||||||
|
ctx); /* user_data */
|
||||||
g_free (command);
|
g_free (command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +238,6 @@ typedef struct {
|
|||||||
MMBroadbandBearer *self;
|
MMBroadbandBearer *self;
|
||||||
MMBaseModem *modem;
|
MMBaseModem *modem;
|
||||||
MMAtSerialPort *primary;
|
MMAtSerialPort *primary;
|
||||||
MMAtSerialPort *secondary;
|
|
||||||
MMPort *data;
|
MMPort *data;
|
||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
} DetailedDisconnectContext;
|
} DetailedDisconnectContext;
|
||||||
@@ -243,7 +246,6 @@ static DetailedDisconnectContext *
|
|||||||
detailed_disconnect_context_new (MMBroadbandBearer *self,
|
detailed_disconnect_context_new (MMBroadbandBearer *self,
|
||||||
MMBroadbandModem *modem,
|
MMBroadbandModem *modem,
|
||||||
MMAtSerialPort *primary,
|
MMAtSerialPort *primary,
|
||||||
MMAtSerialPort *secondary,
|
|
||||||
MMPort *data,
|
MMPort *data,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@@ -254,7 +256,6 @@ detailed_disconnect_context_new (MMBroadbandBearer *self,
|
|||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
||||||
ctx->primary = g_object_ref (primary);
|
ctx->primary = g_object_ref (primary);
|
||||||
ctx->secondary = (secondary ? g_object_ref (secondary) : NULL);
|
|
||||||
ctx->data = g_object_ref (data);
|
ctx->data = g_object_ref (data);
|
||||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||||
callback,
|
callback,
|
||||||
@@ -277,8 +278,6 @@ detailed_disconnect_context_complete_and_free (DetailedDisconnectContext *ctx)
|
|||||||
g_simple_async_result_complete_in_idle (ctx->result);
|
g_simple_async_result_complete_in_idle (ctx->result);
|
||||||
g_object_unref (ctx->result);
|
g_object_unref (ctx->result);
|
||||||
g_object_unref (ctx->data);
|
g_object_unref (ctx->data);
|
||||||
if (ctx->secondary)
|
|
||||||
g_object_unref (ctx->secondary);
|
|
||||||
g_object_unref (ctx->primary);
|
g_object_unref (ctx->primary);
|
||||||
g_object_unref (ctx->modem);
|
g_object_unref (ctx->modem);
|
||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
@@ -294,7 +293,7 @@ disconnect_3gpp_check_status (MMBaseModem *modem,
|
|||||||
const gchar *result;
|
const gchar *result;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
result = mm_base_modem_at_command_finish (modem, res, &error);
|
result = mm_base_modem_at_command_full_finish (modem, res, &error);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
mm_warn ("Disconnect failed: %s", error->message);
|
mm_warn ("Disconnect failed: %s", error->message);
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
@@ -334,16 +333,17 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = detailed_disconnect_context_new (self, modem, primary, secondary,
|
ctx = detailed_disconnect_context_new (self, modem, primary, data, callback, user_data);
|
||||||
data, callback, user_data);
|
|
||||||
|
|
||||||
mm_base_modem_at_command (
|
mm_base_modem_at_command_full (ctx->modem,
|
||||||
ctx->modem,
|
ctx->primary,
|
||||||
"%DPDNACT=0",
|
"%DPDNACT=0",
|
||||||
20, /* timeout */
|
20, /* timeout */
|
||||||
FALSE, /* allow_cached */
|
FALSE, /* allow_cached */
|
||||||
(GAsyncReadyCallback)disconnect_3gpp_check_status,
|
FALSE, /* is_raw */
|
||||||
ctx); /* user_data */
|
NULL, /* cancellable */
|
||||||
|
(GAsyncReadyCallback)disconnect_3gpp_check_status,
|
||||||
|
ctx); /* user_data */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user