Commit Graph

5733 Commits

Author SHA1 Message Date
Ben Chan
36c7136510 novatel-lte: implement modem reset 2012-09-11 08:47:07 +02:00
Ben Chan
776d755d77 iface-modem-3gpp-ussd: avoid update if object skeleton is NULL 2012-09-10 09:28:06 +02:00
Dan Williams
8213a09a34 broadband-modem-qmi: set network port to 802.3/no-QoS mode
The kernel drivers expect this mode, so make sure we set it.
2012-09-08 10:41:01 +02:00
Ben Chan
5f1a1cf834 icera: increase timeout for +CFUN=4 2012-09-08 10:21:56 +02:00
Ben Chan
1252572607 novatel-lte: set default SMS storage to 'SM'
Novatel E362 LTE modem only supports 'SM' and 'SR', but not 'ME'.
2012-09-08 10:19:01 +02:00
Aleksander Morgado
2ca6d62856 broadband-modem: clear error properly as it may be re-used
Avoids this kind of issues:

[mm-sms-list.c:334] mm_sms_list_take_part(): SMS part at 'me/0' is from a singlepart SMS
[mm-iface-modem-messaging.c:475] sms_added(): Added received SMS at '/org/freedesktop/ModemManager1/SMS/31'
[mm-broadband-modem.c:4791] sms_pdu_part_list_ready(): Error parsing PDU (1): PDU too short (2): 41 < 79

GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: PDU too short (3): 28 < (210 + 14), user data length: '203'

[mm-broadband-modem.c:4791] sms_pdu_part_list_ready(): Error parsing PDU (2): PDU too short (3): 28 < (210 + 14), user data length: '203'
2012-09-07 13:13:14 +02:00
Aleksander Morgado
a973825eac sms: multipart sequence starts with 1; singlepart is always 0 2012-09-07 12:20:14 +02:00
Aleksander Morgado
f2cc69bc7f cli: include both current and modem capabilities in modem report 2012-09-07 11:19:46 +02:00
Aleksander Morgado
997848ef4f broadband-modem-qmi: try to use Band Preference for current caps if available
The "NAS Get System Selection Preference" response may come without "Mode
Preference". If that is found, look for "Band Preference" and "LTE Band
Preference" TLVs and try to build capabilities from those.

This makes my UML290 properly report CDMA/EVDO+LTE capabilities:

ModemManager[16586]: [/dev/cdc-wdm0] Received message...
>>>>>> QMUX:
>>>>>>   length  = 55
>>>>>>   flags   = 0x80
>>>>>>   service = "nas"
>>>>>>   client  = 1
>>>>>> QMI:
>>>>>>   flags       = "response"
>>>>>>   transaction = 1
>>>>>>   tlv_length  = 43
>>>>>>   message     = "Get System Selection Preference" (0x0034)
>>>>>> TLV:
>>>>>>   type       = "Result" (0x02)
>>>>>>   length     = 4
>>>>>>   value      = 00:00:00:00
>>>>>>   translated = SUCCESS
>>>>>> TLV:
>>>>>>   type       = "Emergency mode" (0x10)
>>>>>>   length     = 1
>>>>>>   value      = 00
>>>>>>   translated = 0
>>>>>> TLV:
>>>>>>   type       = "Band Preference" (0x12)
>>>>>>   length     = 8
>>>>>>   value      = 07:00:00:00:00:00:00:00
>>>>>>   translated = 7
>>>>>> TLV:
>>>>>>   type       = "CDMA PRL Preference" (0x13)
>>>>>>   length     = 2
>>>>>>   value      = FF:3F
>>>>>>   translated = 16383
>>>>>> TLV:
>>>>>>   type       = "Roaming Preference" (0x14)
>>>>>>   length     = 2
>>>>>>   value      = FF:00
>>>>>>   translated = 255
>>>>>> TLV:
>>>>>>   type       = "LTE Band Preference" (0x15)
>>>>>>   length     = 8
>>>>>>   value      = 00:00:00:00:00:00:00:00
>>>>>>   translated = 0
ModemManager[16586]: KEY: 01:00:01:03:00:00:00:00
ModemManager[16586]:   Service: 03
ModemManager[16586]:   Client ID: 01
ModemManager[16586]:   Transaction ID: 01:00
ModemManager[16586]: <debug> [1347005734.979115] [mm-broadband-modem-qmi.c:321] load_current_capabilities_get_system_selection_preference_ready(): Mode preference not reported in system selection preference
ModemManager[16586]: <debug> [1347005734.979131] [mm-broadband-modem-qmi.c:333] load_current_capabilities_get_system_selection_preference_ready(): Valid bands reported in system selection preference: 'bc-0-a-system, bc-0-b-system, bc-1-all-blocks'
ModemManager[16586]: <debug> [1347005734.979141] [mm-broadband-modem-qmi.c:341] load_current_capabilities_get_system_selection_preference_ready(): LTE band preference found
ModemManager[16586]: [/dev/cdc-wdm0] Sending message...
<<<<<< QMUX:
<<<<<<   length  = 12
<<<<<<   flags   = 0x00
<<<<<<   service = "dms"
<<<<<<   client  = 1
<<<<<< QMI:
<<<<<<   flags       = "none"
<<<<<<   transaction = 1
<<<<<<   tlv_length  = 0
<<<<<<   message     = "Get Capabilities" (0x0020)
ModemManager[16586]: KEY: 01:00:01:02:00:00:00:00
ModemManager[16586]:   Service: 02
ModemManager[16586]:   Client ID: 01
ModemManager[16586]:   Transaction ID: 01:00
ModemManager[16586]: <debug> [1347005734.982676] [mm-at-serial-port.c:392] debug_log(): (ttyACM0): <-- '<CR><LF>OK<CR><LF>'
ModemManager[16586]: <debug> [1347005734.982751] [mm-serial-port.c:969] mm_serial_port_close(): (ttyACM0) device open count is 2 (close)
ModemManager[16586]: <debug> [1347005734.982797] [mm-at-serial-port.c:392] debug_log(): (ttyACM0): --> 'AT+CMEE=1<CR>'
ModemManager[16586]: [/dev/cdc-wdm0] Received message...
>>>>>> QMUX:
>>>>>>   length  = 38
>>>>>>   flags   = 0x80
>>>>>>   service = "dms"
>>>>>>   client  = 1
>>>>>> QMI:
>>>>>>   flags       = "response"
>>>>>>   transaction = 1
>>>>>>   tlv_length  = 26
>>>>>>   message     = "Get Capabilities" (0x0020)
>>>>>> TLV:
>>>>>>   type       = "Result" (0x02)
>>>>>>   length     = 4
>>>>>>   value      = 00:00:00:00
>>>>>>   translated = SUCCESS
>>>>>> TLV:
>>>>>>   type       = "Info" (0x01)
>>>>>>   length     = 16
>>>>>>   value      = B0:9D:57:00:00:DD:6D:00:03:02:05:01:02:04:05:08
>>>>>>   translated = [ max_tx_channel_rate = '5742000' max_rx_channel_rate = '7200000' data_service_capability = '3' sim_capability = '2' radio_interface_list = '{ [0] = '1 ' [1] = '2 ' [2] = '4 ' [3] = '5 ' [4] = '8 '}' ]
ModemManager[16586]: KEY: 01:00:01:02:00:00:00:00
ModemManager[16586]:   Service: 02
ModemManager[16586]:   Client ID: 01
ModemManager[16586]:   Transaction ID: 01:00
ModemManager[16586]: <debug> [1347005734.983353] [mm-broadband-modem-qmi.c:183] modem_load_current_capabilities_finish(): loaded current capabilities: cdma-evdo, lte
2012-09-07 11:19:26 +02:00
Aleksander Morgado
c2952e0adc broadband-modem-qmi: don't always trust the current capabilities reported by SSP
Sometimes the 'Mode Preference' TLV in the SSP response will have incorrect
values. The following log is for a Gobi3k modem which is *only* GMS/UMTS.

ModemManager[13415]: [/dev/cdc-wdm0] Received message...
>>>>>> QMUX:
>>>>>>   length  = 44
>>>>>>   flags   = 0x80
>>>>>>   service = "nas"
>>>>>>   client  = 2
>>>>>> QMI:
>>>>>>   flags       = "response"
>>>>>>   transaction = 1
>>>>>>   tlv_length  = 32
>>>>>>   message     = "Get System Selection Preference" (0x0034)
>>>>>> TLV:
>>>>>>   type       = "Result" (0x02)
>>>>>>   length     = 4
>>>>>>   value      = 00:00:00:00
>>>>>>   translated = SUCCESS
>>>>>> TLV:
>>>>>>   type       = "Emergency mode" (0x10)
>>>>>>   length     = 1
>>>>>>   value      = 00
>>>>>>   translated = 0
>>>>>> TLV:
>>>>>>   type       = "Mode Preference" (0x11)
>>>>>>   length     = 2
>>>>>>   value      = 0F:00
>>>>>>   translated = 15
>>>>>> TLV:
>>>>>>   type       = "Band Preference" (0x12)
>>>>>>   length     = 8
>>>>>>   value      = FF:FF:FF:3F:FF:FF:FF:FF
>>>>>>   translated = 18446744070488326143
>>>>>> TLV:
>>>>>>   type       = "Roaming Preference" (0x14)
>>>>>>   length     = 2
>>>>>>   value      = FF:00
>>>>>>   translated = 255

Instead of setting to '1' only the bits related to GSM/UMTS in the "Mode
Preference" TLV, the modem sets all the bits it knows of to '1', including the
CDMA/EVDO ones. It is not easy to detect this properly, because the modem didn't
set to '1' the bits it didn't know of (e.g. LTE or TD-SCDMA), so we *cannot*
assume that 0x000F actually means 'unknown'.

So, we now will pass these returned values through the "DMS Get Capabilities"
filter, as we did for the Technology Preference result. The final reported
current capabilities will be either:
 * The intersection between the capabilities loaded by "NAS Get System Selection
   Preference" and "DMS Get Capabilities" or,
 * The intersection between the capabilities loaded by "NAS Get Technology
   Preference" and "DMS Get Capabilities".

For 'modem' (not 'current') capabilities, we still rely only on "DMS Get
Capabilities".
2012-09-07 09:51:20 +02:00
Aleksander Morgado
ebc7b3dc70 sms-qmi: implement SMS part deleting 2012-09-06 19:58:03 +02:00
Aleksander Morgado
a8ec884931 sms-qmi: implement singlepart SMS sending 2012-09-06 19:58:02 +02:00
Aleksander Morgado
d3b632c7a8 sms-qmi: implement singlepart SMS storage 2012-09-06 19:58:02 +02:00
Aleksander Morgado
bdf4df2b6b sms-qmi: new `MMSmsQmi' object 2012-09-06 19:58:02 +02:00
Aleksander Morgado
912eea79ef broadband-modem-qmi: implement unsolicited messaging events setup/cleanup 2012-09-06 19:58:02 +02:00
Aleksander Morgado
3db1094e41 broadband-modem-qmi: implement unsolicited messaging events enabling/disabling 2012-09-06 19:58:02 +02:00
Aleksander Morgado
249ec8955c broadband-modem-qmi: minor indentation fix 2012-09-06 19:58:02 +02:00
Aleksander Morgado
0fb980a28a broadband-modem-qmi: load initial SMS parts using QMI 2012-09-06 19:58:02 +02:00
Aleksander Morgado
454b0e1c33 broadband-modem-qmi: implement default storage setting using QMI 2012-09-06 19:58:02 +02:00
Aleksander Morgado
26596b1615 broadband-modem-qmi: no need to setup SMS format, always in PDU mode 2012-09-06 19:58:02 +02:00
Aleksander Morgado
88942a5f1b broadband-modem-qmi: QMI enabled modems have SM and ME messaging storages 2012-09-06 19:58:02 +02:00
Aleksander Morgado
9235a24c11 broadband-modem-qmi: if WMS service is available Messaging is supported 2012-09-06 19:58:02 +02:00
Aleksander Morgado
018d9b458f sms: set state back to UNKNOWN when all SMS parts were deleted 2012-09-06 19:58:02 +02:00
Aleksander Morgado
c9a80609d4 sms: transition from Unknown|Stored to Sent when the SMS is sent 2012-09-06 19:58:02 +02:00
Aleksander Morgado
a5266406ba sms: use property accessors from parent MmGdbusSms when it simplifies things 2012-09-06 19:58:02 +02:00
Aleksander Morgado
8fd02318ec sms: transition from Unknown to Stored in user-created SMS objects 2012-09-06 19:58:02 +02:00
Aleksander Morgado
b03985a019 sms: user-created SMS objects will have either 'text' or 'data' 2012-09-06 19:58:02 +02:00
Aleksander Morgado
39e819788d libmm-common,sms-properties: handle the 'data' property for SMS 2012-09-06 19:58:02 +02:00
Aleksander Morgado
163e167543 sms-part: beware of NULL input data 2012-09-06 19:58:02 +02:00
Aleksander Morgado
98f588867c sms: allow getting list of parts 2012-09-06 19:58:02 +02:00
Aleksander Morgado
a90d149ce4 sms: SMS objects need to be create by `create_modem()' in the Messaging iface
So that plugins can subclass the generic SMS object.
2012-09-06 19:58:01 +02:00
Aleksander Morgado
11740e9075 iface-modem-messaging: plug memleak 2012-09-06 13:16:29 +02:00
Aleksander Morgado
db457fdb46 sms: fix setting full text in object 2012-09-06 13:14:42 +02:00
Aleksander Morgado
28c22ce8db sms-list: add helper debug logs 2012-09-06 13:14:34 +02:00
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
e3152772e5 icera: properly specify MM_BROADBAND_BEARER_ICERA_DEFAULT_IP_METHOD property 2012-09-06 08:45:31 +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
Marius B. Kotsbak
02b71336ae zte: extend allowed modes for LTE/4G devices for +ZSNT command
Updates:
  AT+ZSNT=6 means LTE only
  AT+ZSNT to specify 2G and 3G doesn't support 2G or 3G preference in LTE modems

Tested with a ZTE MF 820D.
2012-09-06 08:40:38 +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
Marius B. Kotsbak
9c2a6320a8 sierra: add support for new !SELRAT values in newer Sierra LTE modems
AT!SELRAT=?
!SELRAT: Index, Name
00, Automatic
01, UMTS 3G Only
02, GSM 2G Only
03, Automatic
04, Automatic
05, GSM and UMTS Only
06, LTE Only
07, GSM, UMTS, LTE
2012-09-03 18:33: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
80fa4cb312 sierra: use generic current capabilities loading
The generic current capabilities loading already has the required extra
AT+WS46=? query to see if LTE capabilities are available.
2012-09-02 16:20:12 +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