aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-10-31 10:54:25 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-10-31 10:54:25 +0100
commitdaf1a353c32e3bbf182e8c9c2948c35627c3111d (patch)
treef5cb0e57639ec7f63bb1be538f3630fe109ec84b /src/mm-base-modem.c
parent25d35b6f915b65565ec90d17bfdaa96a7e6c391f (diff)
core: allow QMI modems without AT ports
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r--src/mm-base-modem.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index 0224e0b5..db277097 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -920,17 +920,22 @@ mm_base_modem_organize_ports (MMBaseModem *self,
/* Fall back to a secondary port if we didn't find a primary port */
if (!primary) {
+#if defined WITH_QMI
+ /* On QMI-based modems we do allow not having a primary AT port */
+ if (!secondary && !qmi_primary) {
+#else
if (!secondary) {
+#endif
g_set_error_literal (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
- "Failed to find primary port");
+ "Failed to find primary AT port");
return FALSE;
+ } else {
+ primary = secondary;
+ secondary = NULL;
}
- primary = secondary;
- secondary = NULL;
}
- g_assert (primary);
/* If the plugin didn't give us any secondary ports, use any additional
* primary ports or backup secondary ports as secondary.
@@ -938,6 +943,17 @@ mm_base_modem_organize_ports (MMBaseModem *self,
if (!secondary)
secondary = backup_primary ? backup_primary : backup_secondary;
+#if defined WITH_QMI
+ /* On QMI-based modems, we need to have at least a net port */
+ if (qmi_primary && !data_primary) {
+ g_set_error_literal (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Failed to find a net port in the QMI modem");
+ return FALSE;
+ }
+#endif
+
/* Data port defaults to primary AT port */
if (!data_primary)
data_primary = MM_PORT (primary);