Commit Graph

71 Commits

Author SHA1 Message Date
Aleksander Morgado
4b37b7d3cf base-modem,at: response processors return a more specific enum
Instead of using the FALSE return of the method to indicate either a
fatal error (if result_error was set) or the continuation request (if
result_error wasn't set), provide a enum that has explicit states for
all three possible values (failure, success or continue).
2020-06-28 15:07:34 +02:00
Aleksander Morgado
05301f23a1 iface-modem-3gpp: new 5GS network support 2020-04-09 12:38:50 +00:00
Aleksander Morgado
4b058872a0 plugins: don't add plugin name in log message explicitly 2020-04-08 17:53:42 +02:00
Aleksander Morgado
8722215f7e plugins: use logging module name as plugin name 2020-04-08 17:53:42 +02:00
Aleksander Morgado
f5ce4a722a altair: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
9e24226364 port-probe: MMPortProbeAtCommand always has constant command strings 2020-01-31 15:18:35 +01:00
Aleksander Morgado
accd1a5841 base-modem: define new helper MMBaseModemAtCommandAlloc
It has the same exact format as MMBaseModemAtCommand, but its contents
are assumed heap allocated.

The only real purpose of this type is to allow defining static
constant MMBaseModemAtCommand variables without warnings when using
-Wdiscarded-qualifiers.
2020-01-31 15:18:35 +01:00
Aleksander Morgado
c1aac8ed26 altair: fix warnings with -Wdiscarded-qualifiers
altair/mm-plugin-altair-lte.c:44:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     44 |     { "AT",  7, mm_port_probe_response_processor_is_at },
        |       ^~~~
  altair/mm-plugin-altair-lte.c:45:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     45 |     { "AT",  7, mm_port_probe_response_processor_is_at },
        |       ^~~~
  altair/mm-plugin-altair-lte.c:46:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     46 |     { "AT",  7, mm_port_probe_response_processor_is_at },
        |       ^~~~
  altair/mm-broadband-modem-altair-lte.c:886:5: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    886 |   { "%STATCM=1", 10, FALSE, response_processor_no_result_stop_on_error },
        |     ^~~~~~~~~~~
  altair/mm-broadband-modem-altair-lte.c:887:5: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    887 |   { "%NOTIFYEV=\"SIMREFRESH\",1", 10, FALSE, NULL },
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  altair/mm-broadband-modem-altair-lte.c:888:5: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    888 |   { "%PCOINFO=1", 10, FALSE, NULL },
        |     ^~~~~~~~~~~~
  ...
2020-01-31 15:18:35 +01:00
Aleksander Morgado
20c23edb83 altair,helpers: fix warnings with -Wsign-compare
CC       altair/tests/test_modem_helpers_altair_lte-test-modem-helpers-altair-lte.o
  In file included from /usr/lib/glib-2.0/include/glibconfig.h:9,
                   from /usr/include/glib-2.0/glib/gtypes.h:32,
                   from /usr/include/glib-2.0/glib/galloca.h:32,
                   from /usr/include/glib-2.0/glib.h:30,
                   from altair/tests/test-modem-helpers-altair-lte.c:20:
  altair/tests/test-modem-helpers-altair-lte.c: In function ‘test_parse_cid’:
  altair/tests/test-modem-helpers-altair-lte.c:98:58: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
     98 |     g_assert (mm_altair_parse_cid ("%CGINFO:blah", NULL) == -1);
        |                                                          ^~
  /usr/include/glib-2.0/glib/gmacros.h:937:25: note: in definition of macro ‘G_LIKELY’
    937 | #define G_LIKELY(expr) (expr)
        |                         ^~~~
  altair/tests/test-modem-helpers-altair-lte.c:98:5: note: in expansion of macro ‘g_assert’
     98 |     g_assert (mm_altair_parse_cid ("%CGINFO:blah", NULL) == -1);
        |     ^~~~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado
40e9434cc3 altair-lte: use autoptr support from glib 2020-01-15 18:56:01 +01:00
Ben Chan
49f391b10d altair-lte: remove unused fields in DetailedDisconnectContext 2019-04-08 13:30:14 -07:00
Ben Chan
0d6e2dc9f5 altair-lte: use mm_autoptr instead of g_autoptr
commit 397faef3c5 ("mm-common-helpers: add mm_autoptr helpers for
GRegex and GMatchInfo") introduces mm_autoptr(), which implements
g_autoptr() that isn't available before glib 2.44. This patch fixes the
code to consistently uses mm_autoptr().
2018-12-13 10:48:21 +01:00
Dan Williams
397faef3c5 mm-common-helpers: add mm_autoptr helpers for GRegex and GMatchInfo
Alias them to g_autoptr() on glib >= 2.44, otherwise re-implement.
2018-12-04 17:39:15 +00:00
Ben Chan
bf1b396596 tests: use memcmp() instead of g_assert_cmpmem() for now
g_assert_cmpmem() isn't available until glib 2.46, while the minimum
glib version required by ModemManager is 2.36. This patch replaces the
uses of g_assert_cmpmem() with memcmp() instead.
2018-11-08 17:00:59 +01:00
Ben Chan
408a2a9c6c altair-lte: migrate from SubscriptionState to Pco property
In preparation of deprecating the SubscriptionState property in the
Modem3gpp interface, this CL updates the altair-lte plugin to update the
Pco property in the Modem3gpp interface upon receiving %PCOINFO
notification.
2018-10-26 09:41:44 -07:00
Ville Skyttä
90b89bb9f4 *: Spelling fixes 2018-01-25 09:52:12 +01:00
Aleksander Morgado
d1436ac0c6 altair: port 3gpp_register_in_network to GTask
And also use mm_base_modem_at_command() instead of the full() version,
as we're anyway mm_base_modem_peek_best_at_port().

This commit also fixes the logic where we make sure the finish()
method completes the GTask that is created in the async method
originally.
2017-10-06 09:44:41 +02:00
Ben Chan
fbf397cd6f altair-lte: don't use send-delay=0
On the modem with firmware revision ALT3100_04_05_06_10_A8_TF
(LTEUSB_02_04_05_10_53), it's observed that port probing doesn't
complete successfully when send-delay=0 is used.
2017-08-04 15:18:35 +02:00
Ben Chan
03d9619759 altair-lte: port modem_3gpp_load_subscription_state, altair_pco_info_changed to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
de4432da21 altair-lte: port modem_3gpp_disable_unsolicited_events to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
e2b161c684 altair-lte: port modem_3gpp_enable_unsolicited_events to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
00aaa1864a altair-lte: port modem_3gpp_{setup,cleanup}_unsolicited_events to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
282ed056a6 altair-lte: port load_current_bands to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
2d82c505e4 altair-lte: port load_supported_bands to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
4ea38c26e0 altair-lte: port load_unlock_retries to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
e2e7121e44 altair-lte: port load_current_capabilities to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
a96e8f824b altair-lte: port modem_create_bearer to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
555883d107 altair-lte: port modem_3gpp_run_registration_checks to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
15109a8513 altair-lte: port disconnect_3gpp to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
710d5c036b altair-lte: port connect_3gpp to use GTask 2017-07-19 17:26:40 +02:00
Aleksander Morgado
0be6e7d2ea altair-lte: fix async completion in 3gpp event handlers setting 2017-07-17 10:20:17 +02:00
Ben Chan
989ade7b8c enums: replace Roman numeral suffixes in MM_MODEM_BAND_EUTRAN_*
3GPP TS 36.101 Table 5.5-1 refers the E-UTRA operating bands as 1, 2, 3,
..., etc.
2017-06-28 18:21:25 +02:00
Aleksander Morgado
2eb55d3224 plugins: use G_N_ELEMENTS when iterating ports array 2017-05-30 17:28:23 +02:00
Aleksander Morgado
fcd4a8c5dc altair,hso,samsung: setup send-delay=0 for probing
The Altair, Option HSO and Samsung plugins all use the send-delay=0
setting once the modem object has been created. For consistency, use
the same setting during port probing.
2017-05-30 17:18:32 +02:00
Aleksander Morgado
fba49d8d00 broadband-modem: normalize also operator code
The operator code (MCCMNC) may also be given encoded in the current
charset (e.g. UCS2).

Based on a patch from Colin Helliwell <colin.helliwell@ln-systems.com>
2017-04-02 10:06:13 +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
Aleksander Morgado
467b3c57f0 modem-helpers: new COPS? response parser
Split into two different actions the actual COPS? response parsing and the
operator name normalization process.

Also, allow parsing not only the operator string, but also the format, mode
and the optional access technology value.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
1f813c4e96 core: allow identifying devices by a user-provided 'uid'
All ports of the same modem reported by the kernel will all be associated with
a common 'uid' (unique id), which uniquely identifies the physical device. This
logic was already in place, what we do now is avoid calling it  the 'sysfs
path' of the physical device, because we may not want to use that to identify
a device.

This logic now also enables the possibility of "naming" the modems in a unique
way by setting the "ID_MM_PHYSDEV_UID" property in the "usb_device" that owns
all the ports.

E.g. a custom device has 4 modems in 4 different USB ports. The device path of
each USB device will always be the same, so the naming rules could go like this:

    $ vim /usr/lib/udev/rules.d/78-mm-naming.rules

    ACTION!="add|change|move", GOTO="mm_naming_rules_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
    LABEL="mm_naming_rules_end"

Each of the modems found will have a unique UID retrieved from the previous list
of rules. Then, "mmcli" has also been updated to allow using the UID instead of
the modem DBus path or index, e.g.:

    $ sudo mmcli -m USB-MODEM-1
    /org/freedesktop/ModemManager1/Modem/0 (device id '988d83252c0598f670c2d69d5f41e077204a92fd')
      -------------------------
      Hardware |   manufacturer: 'ZTE CORPORATION'
               |          model: 'MF637'
               |       revision: 'BD_W7P673A3F3V1.0.0B04'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: '356516027657837'
      -------------------------
      System   |         device: 'USB-MODEM-1'
               |        drivers: 'option'
               |         plugin: 'ZTE'
               |   primary port: 'ttyUSB5'
               |          ports: 'ttyUSB5 (at)'
    ...

    $ sudo mmcli -m USB-MODEM-1 --enable
    ...
2016-09-29 15:41:21 +02:00
Ting-Yuan Huang
969189d42c plugin-manager: protect mm_plugin_{major,minor}_version
This patch makes declarations bind to definitions within the same module
to prevent the potential ambiguity if referenced directly.

AddressSanitizer think they violated one definition rule, although
those symbols are accessed by address through their modules and do
not depend on the order of the libararies loaded.
2016-05-28 13:59:54 +02:00
Aleksander Morgado
ffde429843 core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncs 2015-12-02 17:07:39 +01:00
Roshan Pius
470b02e8c8 port-probe: Increase AT probe command timeout to 7 seconds for altair.
This patch increases the response timeout for the probe AT commands for
altair modems.

We've been noticing some altair modems taking upto 6 seconds to respond to the
initial probe command after a reset which results in modem-manager
timing out and sending a second probe command. The modem sends a response
after about 6 seconds for the initial probe command which modem-manager
treats as response to second probe command and this results in the
modem-manager and modem going out of sync because the modem's second
probe response is treated as response to the next initialization AT command
sent by modem-manager and so on.

Change-Id: Iad8b0786327b153fd95c8ee4516f352325a42cf7
2015-01-09 21:26:01 +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
Thieu Le
0b975f2266 altair-lte: update PCO to handle latest VZW deployment
Update PCO handling code such that it conforms to the latest VZW network
behavior. This includes updating the way we mark a SIM as provisioned.
In the old network, only provisioned SIMs can attach to the network.
Now, unprovisioned SIMs can attach and connect to the network.

Change-Id: Ie454f6fb6d8764161f167e93a4235bb93fbde59a
2014-06-09 16:55:12 +02:00
Thieu Le
a038ff172b altair-lte: handle optional quotes around sim refresh
Some firmware version sends quotes around SIMREFRESH, this patch adds support
for those versions.
2014-06-03 10:52:13 +02:00
Thieu Le
cdb334649d altair-lte: fix memory leak in PCO parsing code
This patch fixes memory leaks in PCO parsing code detected by LeakSanitizer.
2014-05-31 18:55:13 +02:00
Ben Chan
c8f62fb4de altair-lte: ignore invalid bands in %BANDCAP / %GETCFG="BAND" responses
Due to a firmware issue, the modem may reply an invalid band value, such
as 0, for the %BANDCAP or %GETCFG="BAND" command. This patch moves
parse_bands_response() to mm-modem-helpers-altair-lte.c, modifies the
function to ignore any invalid band outside the range of E-UTRAN
operating bands, and add unit tests for the function.
2014-05-29 10:06:37 +02:00
Thieu Le
08d8524b17 altair-lte: prevent connect while processing sim refresh
This patch modifies the Altair LTE plugin to fail connect requests while the
modem has detached from the network when processing sim refresh.
2014-05-28 16:01:56 -05:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00