Commit Graph

2375 Commits

Author SHA1 Message Date
Aleksander Morgado
da606ef572 broadband-modem-qmi: update current capabilities loading logic
Changes being:

 * Don't rely on the band preference TLVs presence. The band preference TLVs are
   always given, even if the modem doesn't support the specific capability right
   away. E.g. a GSM/UMTS/LTE modem configured with 'gsm-umts' capability (no
   'lte') still shows the LTE band preference TLV in the SSP responses.

 * Don't automatically add LTE as current capability. We needed this when we
   were not able to change capabilities, so that we didn't lose the ability to
   set 4G mode as allowed.
2013-06-05 19:15:15 +02:00
Aleksander Morgado
83a8e08c37 broadband-modem-qmi: implement capabilities setting 2013-06-05 19:15:15 +02:00
Aleksander Morgado
a902e6859e api,introspection: new 'SetCurrentCapabilities' method
For those modems which expose a valid 'SupportedCapabilities' property with more
than one item in the list, we'll allow switching between them.
2013-06-05 19:15:15 +02:00
Aleksander Morgado
700ebc5c07 api,introspection: rename 'ModemCapabilities' to 'SupportedCapabilities'
And also make it a list of masks, specifying which are the specific combinations
supported, not just one mask with all.

E.g.:
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7710'
           |       revision: 'SWI9200X_03.05.19.04ap r5475 carmd-en-10527 2012/09/17 17:57:14'
           |      supported: 'gsm-umts
           |                  gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '358178040668164'
2013-06-05 19:15:15 +02:00
Aleksander Morgado
1c67d050cb api,introspection: merge 'AllowedModes' and 'SupportedMode' into 'CurrentModes'
We now have a single 'CurrentModes' property which contains both values in a
tuple with signature "(uu)".

Also, rename 'SetAllowedModes()' to 'SetCurrentModes()', and update the list of
arguments expected to have a single "(uu)" tuple.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
45ceba7692 api,introspection: 'SupportedModes' is now a list of possible combinations
Instead of just a mask of MMModemMode values, we now provide a list of the
allowed and preferred mode combinations supported by the modem. E.g.:

$> sudo mmcli -m 0
  -------------------------
  Modes    |      supported: 'allowed: 2g; preferred: none
           |                  allowed: 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: 2g
           |                  allowed: 2g, 3g; preferred: 3g
           |                  allowed: 4g; preferred: none
           |                  allowed: 2g, 3g, 4g; preferred: none'
2013-06-05 19:15:14 +02:00
Aleksander Morgado
212d00c529 api,instrospection: rename 'Bands' to 'CurrentBands'
... and 'SetBands()' to 'SetCurrentBands()'.

We'll keep the 'Current' keyword in those properties which also have
'Supported' values.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
4dc8d1ff3a broadband-modem-mbim: implement supported IP families loading 2013-06-05 19:15:14 +02:00
Aleksander Morgado
8f3bf6b894 broadband-modem-qmi: implement supported IP families loading
We'll default to IPv4 if the modem is CDMA-only, and IPv4+IPv6 otherwise.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
44ddbf48e2 broadband-bearer: use the new CGDCONT=? test response parser 2013-06-05 19:15:14 +02:00
Aleksander Morgado
7b3dd32df7 broadband-modem: implement default supported IP families loading
For CDMA-only devices, we will default to IPv4.

For 3GPP devices, we will use the AT+CGDCONT=? test command to query which are
the supported PDP types.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
2acb125819 modem-helpers: new CGDCONT=? test response parser 2013-06-05 19:15:13 +02:00
Aleksander Morgado
b3222202bd api,introspection: new 'SupportedIpFamilies' property
This property will let the clients know which are the IP families supported by
the modem.
2013-06-05 19:15:13 +02:00
Aleksander Morgado
7ad30ecce1 modem-helpers: rename CGDCONT? tests
Adding the 'read' suffix, as they are for CGDCONT? read responses.
2013-06-05 19:15:13 +02:00
Aleksander Morgado
804642adc2 api: let MMBearerIpFamily be flags instead of a enumeration
We want to expose in the Modem interface the list of supported IP families, and
the easiest way to do so is to have the IP family as flags, and provide in the
interface a single enum.

Also, a value of 0 for a MMBearerIpFamily specifies that no flags are set, so
just rename it to 'NONE'.

And add a new 'ANY' value which sets all flags to 1.
2013-06-05 19:15:13 +02:00
Aleksander Morgado
a42234dd1c bearers: update connection logic in 3GPP+3GPP2 devices
https://bugzilla.gnome.org/show_bug.cgi?id=701333
2013-06-05 18:55:55 +02:00
Dan Williams
93fcaf93ce modem-helpers: handle commas within +COPS response items (bgo #701329)
Modems can probably put whatever they want between the quotes for
the operator name, including commas.  Handle that.

https://bugzilla.gnome.org/show_bug.cgi?id=701329
2013-05-31 13:13:09 -05:00
Dan Williams
67d3ed11d3 broadband-bearer: don't create PDP context when using an existing one (bgo #701151)
If the context is already defined, then we can just use it instead
of calling +CGDCONT to create it again.  Modems don't like this,
plus it's pointless.

https://bugzilla.gnome.org/show_bug.cgi?id=701151
2013-05-29 08:57:57 +02:00
Aleksander Morgado
d0a8911cf6 modem-helpers-mbim: handle MBIM_PIN_TYPE_UNKNOWN in switch 2013-05-22 17:47:35 +02:00
Aleksander Morgado
619b327012 broadband-modem-qmi: when listing all SMS fails, list per tag
Some QMI modems seem to fail when requesting to list all SMS messages in a given
storage. When this happens, we'll loop through all storages but performing per
tag list requests.
2013-05-20 10:15:28 +02:00
Aleksander Morgado
09d70454b4 sms-qmi: always specify message mode when deleting SMS messages 2013-05-20 10:14:10 +02:00
Aleksander Morgado
5caa0c96fb broadband-modem-qmi: always specify message mode when reading SMS 2013-05-20 10:14:10 +02:00
Aleksander Morgado
2a93ca9281 bearer: defer forced disconnection when modem unregistered while connected
If the bearer is connected and we get a notification of being unregistered, wait
up to 15s to force the disconnection, in case we can recover the registration
in the meantime.

https://bugzilla.gnome.org/show_bug.cgi?id=699803
2013-05-20 09:12:48 +02:00
Aleksander Morgado
e18e168682 bearer: allow registration changes from/to SEARCHING without disconnecting
We allow the modem to be connected while the registration state is 'SEARCHING',
which may happen when the coverage is poor.
2013-05-20 09:08:35 +02:00
Aleksander Morgado
2bb0a23b1f iface-modem-3gpp: remove the deferred registration updates
We should really notify registration updates right away in the DBus interface.
2013-05-20 09:08:35 +02:00
Ben Chan
82a0787906 device: check for NULL driver in add_port_driver
This patch fixes a crash in MMDevice::add_port_driver() due to
g_str_equal() dereferencing a NULL driver returned by
mm_device_utils_get_port_driver().

Bug reported on https://code.google.com/p/chromium/issues/detail?id=241823
2013-05-19 20:27:54 +02:00
Aleksander Morgado
48f47cd53f sms: fix validity variant parsing 2013-05-17 08:49:19 +02:00
Dan Williams
9bbcd9d6a5 sms: add support for message class
We need to redefine the message class property to int since class
0 is a valid message class.  Thus -1 now means "unspecified class".
2013-05-06 10:45:55 -05:00
Ben Chan
9f702aed02 broadband-bearer: fix cid check in disconnect_3gpp
A value 0 is used to denote an invalid/uninitialized CID. This patch
fixes a CID check in disconnect_3gpp() of MMBroadbandBearer such that it
disables all PDP contexts via AT+CGACT=0 when no specific CID is used
(i.e. cid == 0).
2013-05-06 08:44:55 +02:00
Ben Chan
32d6dda859 broadband-modem: update signal quality normalization
This patch updates normalize_ciev_cind_signal_quality() in
MMBroadbandModem to remove an unnecessary check on 'quality >= 0' and
also makes sure the normalized signal quality is capped at 100 when no
maximum is specified.

This is revised from a patch originally authored by
Yunlian Jiang <yunlian@chromium.org>.

Bug reported on https://code.google.com/p/chromium/issues/detail?id=235989
2013-04-30 16:59:09 -05:00
Dan Williams
862eaf4d58 serial-port-qcdm: set SEND_DELAY to 0 (bgo #698869)
For some reason a number of ZTE CDMA devices want the whole QCDM
frame in one USB transaction, or at least don't like it being
broken up and sent byte-by-byte with a send delay.  They simply
don't respond.  Since testing indicates that every other QCDM
capable device I've got also handles a zero send delay on both
3.8.8 and 2.6.32, lets just set it to zero for everything,
which should speed things up a bit too.

https://bugzilla.gnome.org/show_bug.cgi?id=698869
2013-04-30 09:38:32 -05:00
Dan Williams
2e8866c8b7 time: normalize GetNetworkTime() response to local time + timezone info (bgo #697372)
The GetNetworkTime() response is defined to be an ISO8601 string, which
is in turn defined to be in local time.  Make sure that's reflected in
the documentation, and append the timezone offset to UTC where we have
it.

Oddly, Icera devices return their time info in UTC with an offset to
the local timezone, so we have to jump through some hoops there to
convert the response to localtime based on the reported offset.

Some additional fixes by Aleksander Morgado <aleksander@lanedo.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=697372
2013-04-25 15:14:14 -05:00
Dan Williams
7d3a4aba4f broadband-modem: fix assertion during capabilities checking (bgo #698845)
If no capabilities could be determined from the modem's responses,
result would be NULL but no error would be set, since the modem
didn't time out or have some other critical error, it simply didn't
report any recognized capabilities.  Ensure that an error is
reported in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=698845
2013-04-25 15:09:10 -05:00
Aleksander Morgado
135bec690d sms: initialize the validity property when creating SMS 2013-04-25 19:05:04 +02:00
Dan Williams
18bfefba2d iface-modem: fix array insertion when setting bands
You can't g_array_insert_val() to an index that's beyond the end
of the array, which was happening if the user tried to set the
band list to "any":

mmcli -m 0 --set-bands=any

Just use g_array_append_val() instead.

==5618== Invalid read of size 2
==5618==    at 0x4A0A158: memcpy@GLIBC_2.2.5 (mc_replace_strmem.c:881)
==5618==    by 0x326201D8FB: g_array_insert_vals (string3.h:57)
==5618==    by 0x442EFB: mm_iface_modem_set_bands (mm-iface-modem.c:1982)
==5618==    by 0x44307E: handle_set_bands_auth_ready (mm-iface-modem.c:2100)
==5618==    by 0x326386DFF6: g_simple_async_result_complete (gsimpleasyncresult.c:775)
==5618==    by 0x4358E3: authorize_ready (mm-base-modem.c:1300)
==5618==    by 0x326386DFF6: g_simple_async_result_complete (gsimpleasyncresult.c:775)
==5618==    by 0x326386E0F8: complete_in_idle_cb (gsimpleasyncresult.c:787)
==5618==    by 0x3262047A54: g_main_context_dispatch (gmain.c:2715)
==5618==    by 0x3262047D87: g_main_context_iterate.isra.24 (gmain.c:3290)
==5618==    by 0x3262048181: g_main_loop_run (gmain.c:3484)
==5618==    by 0x426235: main (main.c:142)
==5618==  Address 0x10a7ea74e is not stack'd, malloc'd or (recently) free'd
==5618==
==5618==
==5618== Process terminating with default action of signal 11 (SIGSEGV)
==5618==  Access not within mapped region at address 0x10A7EA74E
==5618==    at 0x4A0A158: memcpy@GLIBC_2.2.5 (mc_replace_strmem.c:881)
==5618==    by 0x326201D8FB: g_array_insert_vals (string3.h:57)
==5618==    by 0x442EFB: mm_iface_modem_set_bands (mm-iface-modem.c:1982)
==5618==    by 0x44307E: handle_set_bands_auth_ready (mm-iface-modem.c:2100)
==5618==    by 0x326386DFF6: g_simple_async_result_complete (gsimpleasyncresult.c:775)
==5618==    by 0x4358E3: authorize_ready (mm-base-modem.c:1300)
==5618==    by 0x326386DFF6: g_simple_async_result_complete (gsimpleasyncresult.c:775)
==5618==    by 0x326386E0F8: complete_in_idle_cb (gsimpleasyncresult.c:787)
==5618==    by 0x3262047A54: g_main_context_dispatch (gmain.c:2715)
==5618==    by 0x3262047D87: g_main_context_iterate.isra.24 (gmain.c:3290)
==5618==    by 0x3262048181: g_main_loop_run (gmain.c:3484)
==5618==    by 0x426235: main (main.c:142)
2013-04-25 09:18:53 -05:00
Aleksander Morgado
40dc35a657 modem-helpers: ensure error is set when +CRM response parser doesn't match 2013-04-25 09:36:51 +02:00
Ben Chan
4ac3a6d4f2 bearer: allow specifying default IP family for bearers
This patch adds a 'bearer-default-ip-family' property to MMBearer, which
specifies the default IP family to use for a bearer when no explicit
value is given via the simple connect properties. The default IP family
is set to IPv4 in MMBearer but can be overridden by a MMBearer subclass,
which allows a modem plugin to specify an appropriate default value.
2013-04-23 15:25:48 +02:00
Dan Williams
60845f10c9 broadband-modem-qmi: work around old Gobi 1K firmware SetDataFormat issue
It seems that really old Gobi 1K firmware (from ~2008) doesn't implement
the SetDataFormat command, and will simply ignore the request without
replying to it.  But the device works just fine if we retry the
QMI port open operation without the SetDataFormat request.

The downside of this is is that on older kernels, the qmi_wwan driver
won't automatically fix up any raw-ip packets it receives, but the
old Gobi devices don't ever send raw-ip packets anyway, so it's not
a problem.
2013-04-19 16:24:17 -05:00
Aleksander Morgado
aa4fd7c421 broadband-modem-mbim: don't make no-SIM errors directly fatal, retry instead
The MC7710 will report a MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED status
when initializing and the SIM is not ready yet. So retry a couple of times as we
do for MBIM_SUBSCRIBER_READY_STATE_NOT_INITIALIZED. If all retries are consumed,
get the last reported status to build the error.

This change makes all modems without SIM require up to 10s to get fully
initialized and exposed in DBus; but it shouldn't be a big deal as the modems
are unusable anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=698264
2013-04-19 09:37:20 +02:00
Dan Williams
92035fdf1c iface-modem: skip modem_after_sim_unlock() for CDMA-only devices
We don't support SIM/RUIM on CDMA devices (yet), so for now it makes
no sense to run the after-sim-unlock step on CDMA-only devices where
a SIM won't be present.

Unfortunately we don't know at this point whether there is a SIM
or not, so if the modem is a multi-mode device (implying it has a SIM
slot) and its plugin implements the modem_after_sim_unlock() hook,
the hook will still be executed and might cause an unecessary delay
when a SIM is not inserted.
2013-04-18 12:22:28 -05:00
Aleksander Morgado
7d668eb407 iface-modem: for multimode 3GPP+3GPP2 devices, check if SIM is available
If SIM is not available, no 3GPP caps in current caps.
2013-04-18 18:47:25 +02:00
Aleksander Morgado
4f3932cb2b iface-modem: ignore SIM errors in 3GPP2-capable devices
We already fully skipped SIM unlock check in 3GPP2-only devices; now we also
ignore SIM errors if the device is a 3GPP+3GPP2 device.
2013-04-18 18:47:25 +02:00
Dan Williams
27e1936277 core: rework logging code to remove log message truncation (bgo #698312)
Use a static GString which will resize itself if the log message
is bigger than the current string size, but will also ensure we
don't do a ton of memory reallocation on every log message.

Previously all log messages were trucated at 512 bytes due to the
log buffer char array being 512 bytes long.
2013-04-18 11:23:57 -05:00
Aleksander Morgado
3cb639a6bb plugin-manager: handle race condition during probing
The specific case:
 * Modem exposes cdc-wdm port, Generic plugin probes it successfully as QMI.
 * Modem exposes new ports, including the wwan one. All ttys fail probing
   because they're neither AT nor QCDM (CnS in this case).
 * The wwan port ends up without a port being suggested and is not grabbed.

The root cause of this is that we do not propagate the suggested plugin to newly
added ports when it's the Generic one. If it wasn't the Generic one, the newly
added ports would start with the suggested one for probing.

Now, handle this by looking for the device-specified plugin when the port
probing ends without a specific port given. If there is such a device-specified
plugin accept the port, and otherwise, reject it.
2013-04-18 16:46:47 +02:00
Dan Williams
4d4d614138 broadband-modem: read current capabilities via QCDM if available (bgo #698229)
Many multi-mode Qualcomm devices report all available modes in their
AT+GCAP response (for example, CDMA/EVDO and GSM/UMTS) but they cannot
actually function in all these modes at the same time.  The modem's
actual current capabilities are expressed by the QCDM NV ModePref
item, which is not reflected in the AT+GCAP response.

Reading the current capabilities from the NV ModePref item ensures
that ModemManager does not create interfaces for the modem which
the modem cannot actually implement.

Because the generic modem plugin does not implement the Modem
Capabilities hook (because there is no standard way to determine
what access technologies a modem supports), the Current Capabilities
are copied to the Modem Capabilities.  For devices that support
QCDM this means that Modem Capabilies which used to be created from
the GCAP response and thus would contain all available capabilities
now contain only current capabilities.  This isn't a problem though
since there was no way to switch the devices to use any of their
other capabilities, becuase there aren't any standard commands for
it.  Plugins that know how to switch their modem's capabilities
should (and they already do) override load_current_capabilities
and load_modem_capabilities to get the correct information.
2013-04-18 09:34:21 -05:00
Aleksander Morgado
95274bfa23 sms-part: check UDH length vs available size before trying to read it
https://bugzilla.gnome.org/show_bug.cgi?id=698246
2013-04-18 14:43:37 +02:00
Aleksander Morgado
f8e7f2ebe1 device: look for vendor/product ID on the grandparent for MBIM devices 2013-04-17 15:23:24 +02:00
Aleksander Morgado
99694dec93 bearer-mbim: handle static IP configuration 2013-04-17 15:19:50 +02:00
Aleksander Morgado
91e4c9832a bearer-mbim: update connection timeout values 2013-04-17 15:19:50 +02:00
Aleksander Morgado
07d4aa9938 bearer-mbim: activate packet service during connection request 2013-04-17 15:19:50 +02:00