Commit Graph
104 Commits
Author SHA1 Message Date
Aleksander Morgado 8d2fbc8429 icera: fix warnings with -Wsign-compare
icera/mm-broadband-modem-icera.c: In function ‘icera_band_to_mm’:
  icera/mm-broadband-modem-icera.c:1105:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
   1105 |     for (i = 0 ; i < G_N_ELEMENTS (modem_bands); i++) {
        |                    ^
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7af58f3450 icera: fix warnings with -Wdiscarded-qualifiers
CC       icera/libmm_shared_icera_la-mm-broadband-modem-icera.lo
  icera/mm-broadband-modem-icera.c:1082:30: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1082 |     { MM_MODEM_BAND_UTRAN_1, "FDD_BAND_I",    FALSE },
        |                              ^~~~~~~~~~~~
  icera/mm-broadband-modem-icera.c:1083:30: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1083 |     { MM_MODEM_BAND_UTRAN_2, "FDD_BAND_II",   FALSE },
        |                              ^~~~~~~~~~~~~
  icera/mm-broadband-modem-icera.c:1084:30: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1084 |     { MM_MODEM_BAND_UTRAN_3, "FDD_BAND_III",  FALSE },
        |                              ^~~~~~~~~~~~~~
  icera/mm-broadband-modem-icera.c:1085:30: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1085 |     { MM_MODEM_BAND_UTRAN_4, "FDD_BAND_IV",   FALSE },
        |                              ^~~~~~~~~~~~~
  icera/mm-broadband-modem-icera.c:1086:30: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1086 |     { MM_MODEM_BAND_UTRAN_5, "FDD_BAND_V",    FALSE },
        |                              ^~~~~~~~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 281f656000 icera: fix warnings with -Wshadow
icera/mm-broadband-modem-icera.c: In function ‘modem_create_bearer’:
  icera/mm-broadband-modem-icera.c:873:42: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
    873 |                      MMBearerProperties *properties,
        |                      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  icera/mm-broadband-modem-icera.c:57:20: note: shadowed declaration is here
     57 | static GParamSpec *properties[PROP_LAST];
        |                    ^~~~~~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado b0f9ddd295 icera: fix warnings with -Wsign-compare
icera/mm-modem-helpers-icera.c:256:13: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
    256 |         num != expected_cid) {
        |             ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado a6d76cfceb icera: setup as loadable 'shared' utils 2019-11-27 10:11:43 +00:00
Aleksander Morgado d5d0ed0b24 tests: print MM logs only on verbose test mode
Therefore, avoid needing ENABLE_TEST_MESSAGE_TRACES build symbol.
2019-10-14 15:30:27 +02:00
Lubomir Rintel b39dd2ec05 all: drop unused variables
Keeps build with GCC 8 happy.

mm-base-call.c:758:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-base-call.c:822:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-base-sms.c:908:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-sms-list.c:331:25: warning: variable 'ctx' set but not used [-Wunused-but-set-variable]
mm-iface-modem-messaging.c:1210:21: warning: variable 'storage_ctx' set but not used [-Wunused-but-set-variable]
huawei/mm-plugin-huawei.c:183:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
ublox/mm-plugin-ublox.c:161:24: warning: variable 'response' set but not used [-Wunused-but-set-variable]
ublox/mm-plugin-ublox.c:159:24: warning: variable 'ctx' set but not used [-Wunused-but-set-variable]
icera/mm-modem-helpers-icera.c:218:25: warning: variable 'first_free' set but not used [-Wunused-but-set-variable]
novatel/mm-common-novatel.c:50:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
2018-04-24 18:11:15 +02:00
Aleksander Morgado 4c8a3d0015 icera: port dial_3gpp() to GTask 2017-12-05 10:55:41 +01:00
Ben Chan b25b7723ec icera: port disconnect_3gpp to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan 533a53c38d icera: port get_ip_config_3gpp to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan f2853ac2f8 icera: port modem_3gpp_{enable,disable}_unsolicited_events to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan cffe686cb1 icera: port modem_3gpp_{setup,cleanup}_unsolicited_events to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan e612838814 icera: port modem_create_bearer to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan b7bfba3e54 icera: port modem_time_check_support to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan 18a55f6940 icera: port modem_power_up to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan d6bd83e5cf icera: port modem_set_current_bands to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan 6612ffcb8b icera: port modem_set_current_modes to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan aa2cd2288a icera: port modem_load_current_bands to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan f168ffd032 icera: port modem_load_supported_bands to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan 4ecc8a13fd icera: port modem_load_unlock_retries to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan ce732e568c icera: port modem_load_access_technologies to use GTask 2017-09-13 16:36:49 +02:00
Aleksander Morgado 2c96b31590 icera: update frequency bands support
Updated to use the non-deprecated MMModemBand values.
2017-09-07 10:55:17 +02:00
Aleksander Morgado c44fa6c681 icera: fix async completion in 3gpp event handlers setting 2017-07-17 10:20:17 +02:00
Aleksander Morgado 2eb55d3224 plugins: use G_N_ELEMENTS when iterating ports array 2017-05-30 17:28:23 +02:00
Ben Chan 254f2e3412 plugins: remove explicit GDestroyNotify cast on g_free / g_object_unref
g_free and g_object_unref are in form of  `void (*)(gpointer)`, which
matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
g_free and g_object_unref is thus not needed.
2017-03-29 10:22:18 +02:00
Ben Chan 31655bb5a5 glib: remove invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute
'deprecated') since glib 2.36 as the type system is automatically
initialized. Since the minimum version of glib required by ModemManager
is 2.36, calling g_type_init() isn't necessarily in the ModemManager
code.
2017-02-03 10:05:14 +01:00
Aleksander Morgado 37bd614212 broadband-modem: implement default connection monitoring logic
A default implementation to monitor the ongoing connection is provided in the
generic MMBroadbandModem, based on AT+CGACT? to check whether the PDP context
of the connection (identified by the cached cid) is active or not.

This commit also disables the connection monitoring logic in those plugins that
have custom connection methods.
2016-10-12 11:29:52 +02:00
Dan Williams 830b6ebca8 broadband-bearer-icera: deactivate context before authentication
If the modem thinks a PDP context is already active it'll return
583 errors from IPDPCFG and IPDPACT until the context is
deactivated.  Deactivation was previously done after authentication,
but needs to be done before any part of the connect process to
ensure the PDP context is inactive.

The previous approach worked only if the context was being
deactivated already (which can take a bit of time) because it would
be deactivated after a few seconds and the connect could continue.
This approach works for more cases (like a MM crash and restart
while the modem is connected).
2016-05-24 09:35:49 -05:00
Aleksander Morgado ffde429843 core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncs 2015-12-02 17:07:39 +01:00
Yunlian Jiang 977cf658a6 tests: fix memory leaks 2015-03-27 20:31:24 +01:00
Aleksander Morgado fd28a4d5cd icera: IPv6 '::' is a placeholder for 'no IPv6', so don't error out if found
Also, allow IPDPADDR returns where only DNS IPv6 is given (i.e. no IPv6 address
to set), and in that case default to DHCP method in the bearer.

https://bugs.freedesktop.org/show_bug.cgi?id=85012
2014-12-03 19:02:00 +01:00
Aleksander Morgado 3ca267b01f bearer: rename 'MMBearer' to 'MMBaseBearer'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Ben Chan 9e50209019 icera: fix 'sometimes-uninitialized' variable issues 2014-06-18 08:14:53 -05:00
Dan Williams a416d8056c broadband-bearer-icera: add IPv6 support
Split out the %IPDPADDR parsing into a helper and add testcases for it,
and add support for IPv6 handling.  If the returned IPv6 is link-local,
the address should be assigned to the interface and SLAAC performed to
retrieve the actual IPv6 prefix and RDNSS/DNSSD information.
2014-06-13 11:30:49 -05:00
Dan Williams e9395d83e3 broadband-bearer: pass the IP family to subclasses when getting IP config
Subclasses may need to know which IP families were used for the setup
so they can return the correct IP configuration.  We can't just use
the MMBearer default_ip_family becuase that isn't the family that
was actually used during the connection.
2014-06-13 11:30:49 -05:00
Ben Chan 551197b4e5 plugins: remove unnecessary MM_BASE_MODEM() casts 2014-05-21 11:59:49 +02:00
Ben Chan f5d7213a3c icera: minor coding style fixes 2014-05-20 09:31:18 +02:00
Aleksander Morgado 6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado 9cde02111b ports: rename 'MMSerialPort' to 'MMPortSerial' 2014-02-13 13:39:51 +01:00
Aleksander Morgado d818d9fe06 bearer: consolidate unsolicited connection status reports
Originally developed by:
  Ben Chan <benchan@chromium.org>

This patch replaces mm_bearer_report_disconnection() with a more generic
mm_bearer_report_connection_status(), which allows reporting any
connection status of a bearer. This further allows getting rid of those
custom report_connection_status functions in plugic specific bearer
subclasses.

Note that while plugin-specific implementations can receive multiple
'MMBearerConnectionStatus' values, the generic implementation is only allowed
to receive DISCONNECTED. Plugins need to make sure that they process all the
other status values, and only report DISCONNECTED to the parent when required.

MBM:
  The MBM bearer implementation of report_connection_status() expects either
  CONNECTED or DISCONNECTED. If any of these is received and there is an ongoing
  connection attempt, the corresponding operation will be completed. If there is
  no connection attempt, we will just handle the DISCONNECTED state, calling the
  parent method to notify that the modem got network-disconnected.

Icera:
  The Icera bearer implementation of report_connection_status() expects either
  CONNECTED, CONNECT FAILED or DISCONNECTED. If any of these is received and
  there is an ongoing connection or disconnection attempt, the corresponding
  operation will be completed. If there is no connection or disconnection
  attempt, we will just handle the CONNECT FAILED and DISCONNECTED states,
  calling the parent method (always with DISCONNECTED) to notify that the modem
  got network-disconnected.

Option/HSO:
  The Option/HSO bearer implementation of report_connection_status() expects
  either CONNECTED, CONNECTION FAILED or DISCONNECTED. If any of these is
  received and there is an ongoing connection or disconnection attempt, the
  corresponding operation will be completed. If there is no connection or
  disconnection attempt, we will just handle the CONNECTION FAILED and
  DISCONNECTED states, calling the parent method (always with DISCONNECTED) to
  notify that the modem got network-disconnected.

Huawei:
  The Huawei bearer implementation of report_connection_status() expects either
  CONNECTED or DISCONNECTED. These messages are not used to process pending
  connection or disconnection attempts; so if they are received while one of
  these is on-going, it will just be ignored. CONNECTED reports are also
  ignored, so we will just handle the DISCONNECTED state, calling the parent
  method to notify that the modem got network-disconnected.

Altair-LTE:
  The Altair-LTE bearers will only report DISCONNECTED on network-disconnected
  cases. There is no custom report_connection_status().

Novatel-LTE:
  The Novatel-LTE bearers will only report DISCONNECTED on network-disconnected
  cases. There is no custom report_connection_status().
2013-09-23 08:29:15 +02:00
Aleksander Morgado a420ef3a0a icera: load supported modes with AT%IPSYS=?
http://bugzilla.gnome.org/show_bug.cgi?id=703023
2013-06-26 11:07:19 +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
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 2320411113 broadband-modem-icera: fix issues checking supported bands
Icera devices include bands that the modem doesn't support in
the %IPBM=? list, so the plugin sets the band to its current
enabled/disabled value to test whether that band is supported.
There were two problems with this approach:

1) Setting an already-enabled band to be enabled apparently
isn't a NOP; it might take more than the 3 seconds given, and
if the response comes after 3 seconds, this greatly confuses
ModemManager because the AT command/reply sequence is now
messed up.  So increase the timeout to 10 seconds.

2) Why bother checking bands that are already enabled anyway?
We already know they are supported, so just don't check those
bands at all.  This requires some parkour because we use the
parsed band array from %IPBM=? to track whether bands are
enabled/disabled by indexing into the array, so instead just
use two separate arrays.  This actually makes the fix for #1
un-needed (because we never enable any bands) but it's good
to have #1 anyway.
2013-04-25 09:18:53 -05:00
Aleksander Morgado a294800c7f icera: create generic bearer when no net port available
https://bugzilla.gnome.org/show_bug.cgi?id=697374
2013-04-05 19:10:53 +02:00
Dan Williams fea5b7a670 broadband-modem-icera: make CME 3 errors fail power-up (bgo #696742)
+CME ERROR: 3 (Not Allowed) means airplane mode, at least for the
Samsung Yxxxx devices that I've got.  And if we get this error
on any other devices, chances are they'll fail to power up too.
2013-03-28 12:35:32 -05:00
Aleksander Morgado b6402a4e21 bearer,3gpp: dial operation specifies which data port to use
Instead of deciding in advance which data port to use, we let the dialling
operation gather it. For the generic dialling logic, ATD-based, always an
'AT' port will be used as data port, even if we grabbed a 'net' port. Those
plugins that can work with 'net' ports will grab the specific 'net' port
themselves.
2013-02-18 15:41:26 +01:00
Aleksander Morgado dc9bbefbc0 icera,hso: don't wait to get connected if the primary port is removed
If the primary port is gone (e.g. when going to sleep) and we are just in the
middle of a connection attempt, we won't be able to receive any unsolicited
message regarding the status of the attempt. So, if we detect that the port is
forced to get closed, we'll just treat it as a connection failure.

http://code.google.com/p/chromium-os/issues/detail?id=35391
2012-12-12 12:56:47 +01:00