From accb611e1f7ec648c6a7a6080c89b41fa5f9fd5c Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 26 Feb 2014 11:52:33 +0100 Subject: base-modem: if no AT primary given, try to use data port The Cinterion PHS8 reports a single AT port to be used as data port, and no other port as primary. In this case, recover the tty as primary AT port, instead of failing with an error. --- src/mm-base-modem.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c index f779d178..9c709fcb 100644 --- a/src/mm-base-modem.c +++ b/src/mm-base-modem.c @@ -1249,9 +1249,18 @@ mm_base_modem_organize_ports (MMBaseModem *self, } } - /* Fall back to a secondary port if we didn't find a primary port */ if (!primary) { - if (!secondary) { + /* Fall back to a secondary port if we didn't find a primary port */ + if (secondary) { + primary = secondary; + secondary = NULL; + } + /* Fallback to a data port if no primary or secondary */ + else if (data_primary && MM_IS_PORT_SERIAL_AT (data_primary)) { + primary = MM_PORT_SERIAL_AT (data_primary); + data_primary = NULL; + } + else { gboolean allow_modem_without_at_port = FALSE; #if defined WITH_QMI @@ -1271,9 +1280,6 @@ mm_base_modem_organize_ports (MMBaseModem *self, "Failed to find primary AT port"); return FALSE; } - } else { - primary = secondary; - secondary = NULL; } } -- cgit v1.2.3-70-g09d2