aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r--src/mm-base-modem.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index a048e78a..4f5d4912 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -435,6 +435,32 @@ mm_base_modem_get_best_data_port (MMBaseModem *self)
self->priv->data);
}
+MMAtSerialPort *
+mm_base_modem_get_best_at_port (MMBaseModem *self,
+ GError **error)
+{
+ MMAtSerialPort *port;
+
+ /* Decide which port to use */
+ port = mm_base_modem_get_port_primary (self);
+ g_assert (port);
+ if (mm_port_get_connected (MM_PORT (port))) {
+ /* If primary port is connected, check if we can get the secondary
+ * port */
+ port = mm_base_modem_get_port_secondary (self);
+ if (!port) {
+ /* If we don't have a secondary port, we need to halt the AT
+ * operation */
+ g_set_error (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_CONNECTED,
+ "No port available to run command");
+ }
+ }
+
+ return port;
+}
+
gboolean
mm_base_modem_auth_request (MMBaseModem *self,
const gchar *authorization,