aboutsummaryrefslogtreecommitdiff
path: root/plugins/mm-modem-novatel-gsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mm-modem-novatel-gsm.c')
-rw-r--r--plugins/mm-modem-novatel-gsm.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/mm-modem-novatel-gsm.c b/plugins/mm-modem-novatel-gsm.c
index 265810c3..2d2a96eb 100644
--- a/plugins/mm-modem-novatel-gsm.c
+++ b/plugins/mm-modem-novatel-gsm.c
@@ -159,6 +159,7 @@ static gboolean
grab_port (MMModem *modem,
const char *subsys,
const char *name,
+ MMPortType suggested_type,
gpointer user_data,
GError **error)
{
@@ -166,16 +167,16 @@ grab_port (MMModem *modem,
MMPortType ptype = MM_PORT_TYPE_IGNORED;
MMPort *port = NULL;
- if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_PRIMARY))
- ptype = MM_PORT_TYPE_PRIMARY;
- else if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_SECONDARY))
- ptype = MM_PORT_TYPE_SECONDARY;
+ if (suggested_type == MM_PORT_TYPE_UNKNOWN) {
+ if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_PRIMARY))
+ ptype = MM_PORT_TYPE_PRIMARY;
+ else if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_SECONDARY))
+ ptype = MM_PORT_TYPE_SECONDARY;
+ } else
+ ptype = suggested_type;
port = mm_generic_gsm_grab_port (gsm, subsys, name, ptype, error);
- if (!port)
- return FALSE;
-
- if (MM_IS_SERIAL_PORT (port) && (ptype == MM_PORT_TYPE_PRIMARY)) {
+ if (port && MM_IS_SERIAL_PORT (port) && (ptype == MM_PORT_TYPE_PRIMARY)) {
/* Flip secondary ports to AT mode */
if (mm_serial_port_open (MM_SERIAL_PORT (port), NULL))
mm_serial_port_queue_command (MM_SERIAL_PORT (port), "$NWDMAT=1", 2, dmat_callback, NULL);