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).
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.
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);
| ^~~~~~~~
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().
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.
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.
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.
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.
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.
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>
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.
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.
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.
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.
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
...
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.
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
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
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.