Commit Graph

2375 Commits

Author SHA1 Message Date
Aleksander Morgado
32c41f62e5 sms-part: add helper debug logs 2012-09-06 13:14:16 +02:00
Aleksander Morgado
176498239f sms-part: new `mm_sms_part_new_from_binary_pdu()' method 2012-09-06 13:14:10 +02:00
Aleksander Morgado
4c2951692c bearer: set signal handlers only after setting 'config' and 'modem' properties
Modem plugins may set the 'modem' property before the 'config' property when
creating a bearer. set_signal_handlers() should thus be called after both
properties are set such that modem_{3gpp,cdma}_registration_state_changed
checks roaming allowance correctly when launching a connection.

Based on a draft patch by:
  Ben Chan <benchan@chromium.org>
2012-09-06 08:59:08 +02:00
Ben Chan
143674ea3e sms: use g_variant_new_from_data instead of g_variant_new_fixed_array
ModemManager configure script currenty requires glib 2.30.2 or later,
bud g_variant_new_fixed_array requires at least glib 2.32. To maintain
the compatibility with glib 2.30, this patch modifies the code to use
g_variant_new_from_data instead of g_variant_new_fixed_array.
2012-09-06 08:44:34 +02:00
Aleksander Morgado
4804c37604 build: new `--without-qmi' configure option
For those who don't care about the QMI support through libqmi-glib, or if you're
stuck with glib 2.30 (libqmi-glib requires 2.32), this configure switch allows
disabling the QMI support completely.

The logic to detect cdc-wdm ports is still in place, but the QMI probing is
never launched at them. Also, all QMI-related objects won't be compiled.
2012-09-05 20:02:31 +02:00
Aleksander Morgado
bf1da3faea iface-modem-simple: never remove connected bearers
Modems have a maximum of bearers allowed to be connected at a time, number which
is given by the number of available ports that may be used for data connections.

When Simple.Connect() tries to launch a connection, it will try to find first an
existing bearer with the required parameters (e.g. APN, IP type). If such bearer
is found, it will just use it. If no such bearer is found, it will try to create
one. When trying to create one, if there is no more room for bearers in the
modem, we will remove the first disconnected bearer that we find, if any, before
trying to create the new one. This logic now makes sure that no connected bearer
gets removed in order to create a new one, and also that only one existing gets
removed if possible (not every bearer as we did previously).

Further logic to connect multiple bearers at a time cannot be done using the
Simple interface.
2012-09-04 11:34:00 +02:00
Aleksander Morgado
72db2a53ed plugin: defer task if supports check tells us to retry
Huawei modems will probe interface 0 always first; if we try to probe another
interface meanwhile the supports check will give us a MM_CORE_ERROR_RETRY error,
indicating that we need to defer the probing of the port.
2012-09-04 10:21:44 +02:00
Aleksander Morgado
d99169022e iface-modem: don't try to use the bearer list if there is none
When the modem gets unplugged, or system gone into suspend, we start losing the
modem ports one by one. When the last is lost, we trigger the disposal of the
modem (we call g_object_run_dispose() and then we call the main-reference
unref()). So, if we end up losing all ports while the connection sequence was
being run, we would end up in this situation, where we try to disconnect the
bearers (the bearer and modem objects are still valid, as we have references
around, but the list of bearers won't be available any more in the modem object
as it was cleared in the modem dispose().

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x7f5cdbd5cda0   [ModemManager]                 - mm-bearer-list.c:163]      mm_bearer_list_foreach
0x7f5cdbd6a4bd   [ModemManager]                 - mm-iface-modem.c:110]      bearer_status_changed
0x7f5cdbad0903   [libgobject-2.0.so.0.3000.2]   - gclosure.c:774]            g_closure_invoke
0x7f5cdbae1dbb   [libgobject-2.0.so.0.3000.2]   - gsignal.c:3272]            signal_emit_unlocked_R
0x7f5cdbaeac82   [libgobject-2.0.so.0.3000.2]   - gsignal.c:3003]            g_signal_emit_valist
0x7f5cdbaeae5e   [libgobject-2.0.so.0.3000.2]   - gsignal.c:3060]            g_signal_emit
0x7f5cdbad3876   [libgobject-2.0.so.0.3000.2]   - gobject.c:925]             g_object_dispatch_properties_changed
0x7f5cdbad5ceb   [libgobject-2.0.so.0.3000.2]   - gobjectnotifyqueue.c:132]  g_object_notify_by_pspec
0x7f5cdbd56b08   [ModemManager]                 - mm-bearer.c:112]           bearer_update_status
0x7f5cdbd56ffd   [ModemManager]                 - mm-bearer.c:393]           disconnect_ready
0x7f5cdbbcc676   [libgio-2.0.so.0.3000.2]       - gsimpleasyncresult.c:749]  g_simple_async_result_complete
0x7f5cdbbcc788   [libgio-2.0.so.0.3000.2]       - gsimpleasyncresult.c:761]  complete_in_idle_cb
0x7f5cdb7cff44   [libglib-2.0.so.0.3000.2]      - gmain.c:2441]              g_main_context_dispatch
0x7f5cdb7d0597   [libglib-2.0.so.0.3000.2]      - gmain.c:3089]              g_main_context_iterate
0x7f5cdb7d0b51   [libglib-2.0.so.0.3000.2]      - gmain.c:3297]              g_main_loop_run
0x7f5cdbd4e331   [ModemManager]                 - main.c:150]                main
0x7f5cdb1ea41c   [libc-2.15.so]                 - libc-start.c:234]          __libc_start_main
0x7f5cdbd4de48   [ModemManager]   + 0x00019e48]

Reported by Ben Chan <benchan@google.com>
2012-09-03 09:43:52 +02:00
Aleksander Morgado
f146c3a3dc broadband-modem: avoid segfault when initialization sequence is aborted
The ports context is only set if the initialization sequence succeeds; so don't
try to clear the ports context if it wasn't set.
2012-09-02 16:34:39 +02:00
Aleksander Morgado
22d70792dc broadband-modem: run an extra AT+WS46=? when querying current capabilities
Some modems (e.g. Sierra Wireless MC7710 or ZTE MF820D) won't report LTE
capabilities even if they have them. So just run AT+WS46=? as well to see
if the current supported modes list includes any LTE-specific mode.

This is not a big deal, as the AT+WS46=? command is a test command with a
cache-able result, so the next time we need the command result (when loading
supported modes) the value will be loaded from the cache.
2012-09-02 16:17:48 +02:00
Marius B. Kotsbak
5eab715bb6 modem-helpers: recognize "4G" as LTE access technology
Some modems (e.g. ZTE MF 820D) report LTE access technology as "4G":
  +ZPAS: "4G","PS_ONLY"
2012-09-02 15:32:59 +02:00
Dan Williams
6f2c440b7b broadband-modem-qmi: fix handling of current and overall modem capabilities
Current capabilities is the set of *active* radios that can be used
right now.  Modem capabilities are the set of all radios the modem
could use, if some action were performed to enable them if they are
not enabled already (firmware reload, changing allowed mode, etc).

For QMI devices, the DMS Get Capabilities command represents all
radios, and thus "modem capabilities".

But to read *current* capabilities, ie active radios, we need to
query the NAS System Selection Preference and grab the "mode
preference" TLV.  Unfortunately that is only available with NAS
>= 1.1, which means older Gobi devices (1K and 2K) don't support
it.  So for older devices, we try to get the Technology Preference
(which takes into account user-requested limitations) and then
mask that with the DMS Get Capabilities result for a best-effort
current capabilities.

For example, the Pantech UML290VW reports DMS Get Capabilities
of "cdma, evdo, gsm, umts, lte", but a more limited SSP mode
preference according to what modes are actually enabled.  Gobi
1K devices don't support SSP, and the DMS Get Capabilities
reports cdma/evdo or gsm/umts depending on the currently loaded
firmware.  Previous to this patch, ModemManager reported all
modes as available on the UML290, ignoring what modes were
actually enabled.
2012-08-31 12:30:13 -05:00
Aleksander Morgado
04ce8b567c broadband-modem-qmi: use System Selection Preference when available
Get/Set Technology Preference was introduced in NAS 1.0, so should be always
available (even if we thought it was introduced in NAS 1.7, that's not true).
But the newer System Selection Preference behaves better as it allows more
features like 'preferred' modes; so use it when available (NAS >= 1.1).
2012-08-31 17:44:45 +02:00
Aleksander Morgado
20539a88e6 broadband-modem-qmi: fix compilation when using `--with-newest-qmi-comands' 2012-08-31 16:50:56 +02:00
Aleksander Morgado
fa8c09ca66 port-probe: speed up QCDM probing a bit
This is the port to git master of the following commit:

commit 01201860de5565a78823913423c6b2a762e3731f
Author: Dan Williams <dcbw@redhat.com>
Date:   Tue Aug 28 21:12:14 2012 -0500

    core: speed up QCDM probing a bit

    The point of sending two "version info" commands was to ensure that
    the terminating 0x7E of the first one was processed as a QCDM frame
    boundary and that any random data in the buffer (like AT commands
    from probing) got cleared out.  The second command would always
    get processed as a valid QCDM command if the device supported QCDM,
    since there was no garbage before it.

    Instead of that dance, just prepend the version info message with
    an extra 0x7E to ensure a clean QCDM frame which the device hopefully
    responds to immediately.  Second, actually process that response
    instead of throwing it away.  Should save about 3 seconds when
    probing QCDM ports.
2012-08-31 15:11:30 +02:00
Aleksander Morgado
529eecdb97 modem-helpers: new helper to convert from netmask string to CIDR 2012-08-31 15:11:29 +02:00
Aleksander Morgado
e8ca43e315 broadband-modem: if the generic CNMI request fails, try a Qualcomm-compatible one
This is the port to git master of the following commit:

commit 1d9164ec90788d1be134482ff88c501e3c5d623c
Author: Dan Williams <dcbw@redhat.com>
Date:   Mon Aug 27 18:20:33 2012 -0500

    gsm: if the generic CNMI request fails, try a Qualcomm-compatible one

    Many devices based on Qualcomm chipsets don't support a <ds> value
    of '1', despite saying they do in the AT+CNMI=? response.  But they
    do accept '2'.  Since we're not doing much with delivery status
    reports yet, if we get a CME 303 (not supported) error when setting
    the message indication parameters via CNMI, fall back to the
    Qualcomm-compatible CNMI parameters.

    If we don't do this, we don't get SMS indications on these devices,
    because the original CNMI failed.

    Tested on Huawei E1550, Huawei E160G, ZTE MF622, and Novatel XU870.
2012-08-31 12:31:00 +02:00
Aleksander Morgado
a3d32c552c sms: fix handling of 'data' property for multipart messages
This is the port to git master of the following commit:

commit 1c29ce5999d11dee2898e7bf41c00995a00c71d0
Author: Dan Williams <dcbw@redhat.com>
Date:   Mon Aug 27 17:36:49 2012 -0500

    sms: fix handling of 'data' property for multipart messages

    Text was getting concatenated when reconstructing the full message,
    but the data wasn't.  That meant that non-text multipart messages,
    like the binary APN/MMS settings messages that operators often send,
    were broken.
2012-08-31 12:13:45 +02:00
Aleksander Morgado
19e91c5c79 sim: better handling of IMSI response
This is a port to git master of the following commit:

commit 0b051f9c7033143c56f59267794d1cadf4bd3416
Author: Dan Williams <dcbw@redhat.com>
Date:   Mon Aug 27 10:24:50 2012 -0500

    gsm: better handling of IMSI response

    Moto EZX devices prefix the response with "+CIMI:" while most
    devices do not.
2012-08-31 10:08:11 +02:00
Aleksander Morgado
1e5b00e33b plugin: let plugins decide if they want echo removal during AT probing
This is the port to git master of the following patch:

commit 21e66dfa1774ac2ee037ac8b6e8bb4d71a6f7931
Author: Dan Williams <dcbw@redhat.com>
Date:   Thu Aug 23 21:13:35 2012 -0500

    core: add function to open probe ports without removing echo

    Some devices (Sierra GSM ones) return stuff we need but don't
    bother to prefix it with <CR><LF>, so we need to optionally turn
    off the echo removal at probe time.
2012-08-31 09:20:43 +02:00
Aleksander Morgado
9faba58226 bearer: check only roaming allowance when launching a connection
Don't abort the connection if the modem reports unregistered in either
3GPP or CDMA, as mixed CDMA+3GPP modems may connect even if not registered
in both technologies.
2012-08-31 00:22:27 +02:00
Aleksander Morgado
f61db0fc4b broadband-modem-qmi: implement current bands loading
Also, sync with libqmi:

commit b03ca502f45f75541c2b2ccebf44e712ab925456
Author: Aleksander Morgado <aleksander@lanedo.com>
Date:   Thu Aug 30 19:17:19 2012 +0200

    nas: consolidate `QmiNasActiveBand' names
2012-08-30 19:18:05 +02:00
Aleksander Morgado
4f406b2c38 broadband-modem-qmi: move common enum translators to new -helpers-qmi.[ch] files 2012-08-30 18:36:11 +02:00
Aleksander Morgado
5e448cf5d3 bearer-qmi: try to use proper QMI port to connect a given net interface 2012-08-30 17:08:29 +02:00
Aleksander Morgado
36733aa4de base-modem: allow looking for the QMI port associated to a given data port
QMI and wwan ports come in pairs. Each wwan port has an associated control QMI
port, which is the only port allowed to send the Start|Stop Network QMI requests
to start|stop the connection in the given wwan interface.

Paired QMI and wwan interfaces (should) share the same parent udev device,
quoting Bjørn:

    "If we ignore the unfortunate 3.4 and 3.5 kernels, then a matching wwanX
     and cdc-wdmY set will always share the same parent USB interface on QMI
     devices.

     Having the same parent USB device is *not* sufficient.  You cannot control
     wwan0 using cdc-wdm1 in the above example."
2012-08-30 17:08:23 +02:00
Aleksander Morgado
3132e34dc1 iface-mode-simple: when setting bands or modes, wait some time to settle down
When bands or allowed modes are changed, the modem will very likely reset its
current registration and start from scratch. We will now give it some seconds
to settle down before going on with the connection request, so that the modem
has enough time to report being unregistered. Without this sleep time, the
unsolicited message reporting being unregistered may arrive *after* having
checked registration status in the Simple connect sequence, and therefore we
end up failing the connection request.
2012-08-30 16:36:38 +02:00
Aleksander Morgado
aa51a16f70 port-probe: fix generic icera support check during probing 2012-08-30 14:24:16 +02:00
Aleksander Morgado
1ca46bb4a7 port-probe: easier check for Icera support over a list of port probes 2012-08-30 13:57:56 +02:00
Aleksander Morgado
a4e5964506 bearer: add roaming connection allowance rules from the broadband bearer
Connection allowance rules need to be applied to every kind of bearer,
regardless of whether it's based on the generic broadband bearer or not.
2012-08-30 13:35:37 +02:00
Aleksander Morgado
58553df9bb bearer-qmi: 'no-effect' errors while disconnecting aren't fatal 2012-08-30 11:26:28 +02:00
Aleksander Morgado
2edbf674e0 bearer-qmi: assume we need the global packet data handle on no-effect errors 2012-08-30 11:26:22 +02:00
Aleksander Morgado
1c49e35a8e iface-modem: run after-sim-unlock also when PIN request is not enabled
Whenever we query current unlock required status and we get that we're unlocked,
we'll launch the after-sim-unlock step so that we try to ensure that the SIM is
ready.
2012-08-30 09:17:43 +02:00
Aleksander Morgado
4114eabaa3 plugin-manager: never suggest result to the probe which generated the suggestion 2012-08-30 00:33:30 +02:00
Aleksander Morgado
72602a3951 qmi-bearer: use new enum types for call end reasons
Sync with libqmi:

commit d473f9ab35b85b76ebd6510a69a49ffa141d85f1
Author: Aleksander Morgado <aleksander@lanedo.com>
Date:   Tue Aug 28 13:18:44 2012 +0200

    wds: implement "Verbose Call End Reason" types

commit d39c997771da9a8037e61f1b4fc5ccfbb34be952
Author: Aleksander Morgado <aleksander@lanedo.com>
Date:   Mon Aug 27 20:29:16 2012 +0200

    wds: implement "Call End Reason" type
2012-08-29 17:26:47 +02:00
Aleksander Morgado
4cb6c42d6c qmi-bearer: fix IPv6 disconnection logic 2012-08-29 17:26:47 +02:00
Aleksander Morgado
84e69a1abb bearer-qmi: only keep internal state if IP type specific connection succeeds 2012-08-29 17:26:47 +02:00
Aleksander Morgado
c468e5b352 bearer-qmi: if possible, use "WDS Set IP Family" to select IP family preference 2012-08-29 17:26:47 +02:00
Aleksander Morgado
ea7edbbf9e bearer-qmi: only specify IP family preference TLV if one explicitly requested 2012-08-29 17:26:47 +02:00
Aleksander Morgado
fb93226858 bearer-qmi: allocate different WDS clients for IPv4 and IPv6 setups 2012-08-29 17:26:47 +02:00
Aleksander Morgado
28eb5df342 qmi-port: allow allocating more than one client of a given service
We'll uniquely identify each client generated by the service ID and a user
defined flag, so that we then allow to peek/get the specific client.
2012-08-29 17:26:47 +02:00
Aleksander Morgado
a8cf6f6278 bearer-qmi: enable dual IPv4/IPv6 connections
We provide separate steps to connect/disconnect IPv4 and IPv6.
2012-08-29 17:26:47 +02:00
Aleksander Morgado
7c291ab7a3 bearer-qmi: make compiler happy 2012-08-29 17:26:47 +02:00
Aleksander Morgado
26d9538104 bearer-qmi: 'no-effect' errors while starting network aren't fatal 2012-08-29 17:26:47 +02:00
Aleksander Morgado
5fdb820f28 bearer-qmi: pass down APN/username/password/IP-type to `WDS Start Network' 2012-08-29 17:26:47 +02:00
Aleksander Morgado
60b0812d3a bearer-qmi: implement connection/disconnection sequences 2012-08-29 17:26:47 +02:00
Aleksander Morgado
02c049ce7d broadband-modem-qmi: create a `MMBearerQmi' always by default
We still don't consider the case of having all net ports already connected and
falling back to PPP over a serial port.
2012-08-29 17:26:47 +02:00
Aleksander Morgado
b29fcde7e2 bearer-qmi: new `MMBearerQmi' object
This bearer type does not inherit from `MMBroadbandBearer', and therefore it
doesn't need to be async-initable.
2012-08-29 17:26:46 +02:00
Aleksander Morgado
1525c6a154 build: minor reorder of files to build 2012-08-29 17:26:46 +02:00
Aleksander Morgado
c07490887a broadband-bearer: remove obsolete property names 2012-08-29 17:26:46 +02:00
Aleksander Morgado
e2a6be368e iface-modem: max number of bearers equal to the number of available data ports 2012-08-29 17:26:46 +02:00