Commit Graph
3168 Commits
Author SHA1 Message Date
Aleksander Morgado 32aa8333c6 helpers,tests: update ICCID related unit tests
Fix the test for invalid characters, because now I allow hex chars in
the account number.

And add new tests with real China Mobile ICCIDs that contain hex chars
in the account number.
2018-09-12 17:17:36 +00:00
Aleksander Morgado 099d54a4bc helpers: allow [A-F] range in operator-specific ICCID account number
There are operators (e.g. the Chinese CMCC operator) that abuse the
fact that 4 bits are used to store the BCD encoded numbers, and also
use the [A-F] range as valid characters for the ICCID in the operator
specific account number part. Haven't seen any documentation where
this format with [A-F] characters is explicitly allowed, but I have
seen multiple real cases where it happens. E.g.:

  898602F9091830030220
  898602C0123456789012

This patch also removes the 'last F' validation, used when reading
19-digit ICCIDs with +CRSM, as it no longer applies.
2018-09-12 17:17:36 +00:00
Aleksander Morgado 0282123287 helpers: allow 19-digit reported ICCIDs
The mm_3gpp_parse_iccid() method does validation of the ICCID string
and was originally implemented to handle +CRSM reported values. The
implementation was looking for 20-digit strings, even for 19-digit
ICCIDs (those finished with a trailing 'F').

We now extend the logic to also validate ICCID strings reported as
19-digit values directly, and when that happens we won't allow
swapping of the digits (a +CRSM specific requirement) or trailing 'F'
characters (as that is only required when reporting 19-digit ICCIDs
with 20-digit strings).

This change allows us to e.g. use the u-blox specific AT+CCID command
and validate the returned ICCID with the same helper method, which
currently fails:

  (ttyACM2): --> 'AT+CCID<CR>'
  (ttyACM2): <-- '<CR><LF>+CCID: 8934077700015848638<CR><LF><CR><LF>OK<CR><LF>'
  couldn't load SIM identifier: 'Invalid ICCID response size (was 19, expected 20)'
2018-09-12 17:17:36 +00:00
Aleksander Morgado 4c669d3bf4 modem-helpers: reuse nicknames for the flow control tags
And check that the string given in the tag is actually a valid one.
2018-09-12 17:15:46 +00:00
Aleksander Morgado fc1beefe92 port-serial: improve logging in mm_port_serial_set_flow_control() 2018-09-12 17:15:46 +00:00
Aleksander Morgado 727567cf58 broadband-bearer: no need for explicit flow control cleanup on disconnect
We're already configuring the flow control we expect when running
mm_port_serial_reopen(), which will keep the udev-selected flow
control or will otherwise reset to no flow control when the TTY is in
command mode.
2018-09-12 17:15:46 +00:00
Aleksander Morgado cd762addfd broadband-modem: allow subclasses to modify the flow control settings
If a subclass implements a custom setup_flow_control() logic, e.g. to
select a very specific setting explicitly, let it also configure the
flow control settings modem-wide via the modem object property, so
that bearer objects can later on use the same settings when preparing
for a new connection.
2018-09-12 17:15:46 +00:00
Aleksander Morgado a9f871805b broadband-modem: rework flow control selection logic
Try to simplify a bit the logic that selects the flow control to be
used during connectivity:

 * We detect early if the requested flow control (via udev tags) is
   actually supported by the modem (as eported by AT+IFC=?), and if it
   isn't, we error out directly.

 * We try to set in a single place the AT commands to be used to setup
   the flow control, once we have decided which one we're going to
   use.

 * Use the string builder helpers to log the flow control values.
2018-09-12 17:15:46 +00:00
Aleksander Morgado b773e610eb port-serial,broadband-modem: minor coding style fixes 2018-09-12 17:15:46 +00:00
Aleksander Morgado f253c15c1f port-serial: improve logging of device-level flow control settings 2018-09-12 17:15:46 +00:00
Aleksander Morgado 48d2fa399a port-serial: Flow Control property is flags, not enum
MMFlowControl is a flags enumeration, so change the property type to
match that, or we'll end up with nasty criticals during runtime.

    (ModemManager:30758): GLib-GObject-CRITICAL **: 10:54:26.435: g_param_spec_enum: assertion 'G_TYPE_IS_ENUM (enum_type)' failed

    Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
    0x00007ffff71f2a96 in ?? () from /usr/lib/libglib-2.0.so.0
    (gdb) bt
    #0  0x00007ffff71f2a96 in  () at /usr/lib/libglib-2.0.so.0
    #1  0x00007ffff71f3def in g_logv () at /usr/lib/libglib-2.0.so.0
    #2  0x00007ffff71f3fe0 in g_log () at /usr/lib/libglib-2.0.so.0
    #3  0x00007ffff72d90ac in g_param_spec_enum () at /usr/lib/libgobject-2.0.so.0
    #4  0x000055555564caf2 in mm_port_serial_class_init (klass=0x5555557607c0) at mm-port-serial.c:2101
    #5  0x000055555564759a in mm_port_serial_class_intern_init (klass=0x5555557607c0) at mm-port-serial.c:49
    #6  0x00007ffff72ea9b4 in g_type_class_ref () at /usr/lib/libgobject-2.0.so.0
    #7  0x00007ffff72eab5a in g_type_class_ref () at /usr/lib/libgobject-2.0.so.0
    #8  0x00007ffff72d0f53 in g_object_new_valist () at /usr/lib/libgobject-2.0.so.0
    #9  0x00007ffff72d103a in g_object_new () at /usr/lib/libgobject-2.0.so.0
    #10 0x000055555564e187 in mm_port_serial_at_new (name=0x55555576e280 "ttyUSB4", subsys=MM_PORT_SUBSYS_TTY) at mm-port-serial-at.c:533
    #11 0x0000555555602512 in serial_open_at (self=0x555555715390) at mm-port-probe.c:1285
    #12 0x00007ffff71ecb49 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
    #13 0x00007ffff71ecf59 in  () at /usr/lib/libglib-2.0.so.0
    #14 0x00007ffff71ed272 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
    #15 0x00005555555957e0 in main (argc=3, argv=0x7fffffffe458) at
    main.c:181

Also, rename the property to match the naming convention of other
properties in the same object.
2018-09-12 17:15:46 +00:00
Alfonso Sánchez-Beato e3c2f0e9cc broadband-modem: set flow control from port
Set the flow control used in the data connection from the one
set in the port.
2018-09-12 17:15:46 +00:00
Alfonso Sánchez-Beato 94879ce1ce base-modem,port-probe: set serial port flow control from udev tag
Set the serial port flow control from the udev tag
ID_MM_TTY_FLOW_CONTROL before accessing the port.
2018-09-12 17:15:46 +00:00
Alfonso Sánchez-Beato 4e69c10c2d port-serial: add flow control property
Add flow control property to the MMPortSerial class, and use it when
setting the port flow control.
2018-09-12 17:15:46 +00:00
Alfonso Sánchez-Beato a1c27bf89d modem-helpers: add flow control udev tag parser
Add function for parsing the content of the udev tag
ID_MM_TTY_FLOW_CONTROL.
2018-09-12 17:15:46 +00:00
Aleksander Morgado 6e84f3d459 iface-modem-location: validate SUPL server address
Devices will expect SUPL server given as either IP:PORT or FQDN:PORT,
so just avoid saying we require a 'URL' because it's not true.

We will use a new helper method to parse and validate user-provided
SUPL server address.
2018-09-12 17:14:36 +00:00
Aleksander Morgado 47ed19d5be broadband-bearer: don't do connection checks on CDMA
On CDMA-only connections we won't have a CID defined, so instead of
getting in a loop of warnings reporting "cid not defined", early error
out with an UNSUPPORTED error so that the connection check isn't tried
any more.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/83
2018-09-08 10:04:58 +02:00
Ben Chan 21420e450d broadband-modem: port modem_cdma_register_in_network to use GTask 2018-09-07 08:35:44 -07:00
Ben Chan fcec3b3355 broadband-modem: port modem_cdma_setup_registration_checks to use GTask 2018-09-07 08:35:44 -07:00
Ben Chan c0607ede9b broadband-modem: port modem_cdma_setup_cleanup_unsolicited_events to use GTask 2018-09-07 08:35:44 -07:00
Ben Chan a51a0ba23e broadband-modem: port modem_load_access_technologies to use GTask 2018-09-07 08:35:44 -07:00
Aleksander Morgado 2d7bf65093 broadband-modem-qmi: avoid completing the GTask twice when loading capabilities 2018-09-06 10:43:20 +02:00
Aleksander Morgado e953d285c1 broadband-modem-qmi: add missing task unref when loading signal values 2018-09-06 10:43:15 +02:00
Aleksander Morgado 38de53b195 broadband-modem-qmi: make sure result values are not in context when completing
In order to avoid having the result values in 2 places (context and
result) when the GTask is completed, we will steal the pointer from
the context before it's set as result of the GTask.
2018-09-06 10:43:12 +02:00
Paul Bartell 6e8aab2c4e broadband-modem-qmi: Pass signal values_result directly rather than duplicating with g_memdup
corrects segfault introduced in 7d8f0600e6

Signed-off-by: Paul Bartell <p.bartell@temperednetworks.com>
2018-09-04 14:20:19 -07:00
Ben Chan 1b3b2e26a7 test,modem-helpers: remove unnecessary NULL check for g_free()
g_free() handles a NULL pointer properly, so there is no need to have a
NULL check before calling g_free().
2018-08-29 08:35:46 +02:00
Aleksander Morgado 28c1acf2e1 port-probe: fix build when QMI over MBIM is unsupported 2018-08-28 09:25:37 +02:00
Ben Chan 0520836afa mbim: fix inconsistency in WITH_QMI guards 2018-08-23 09:44:28 +02:00
Ben Chan 6530683cfb broadband-modem-mbim: add missing guard for shared_qmi_init()
Fixes: 9e42a19742
2018-08-22 17:21:34 +02:00
Ben Chan 2729b08696 port-mbim: add missing guard for try_qmi_over_mbim in mm_port_mbim_open()
Fixes: c0cc694c67
2018-08-22 17:21:24 +02:00
Ben Chan f6c310ba82 shared-qmi: include string.h for memset()
This patch fixes the following compiler warning:

mm-shared-qmi.c:447:9: error: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned long)' [-Werror,-Wimplicit-function-declaration]
        memset (buf, 0, sizeof (buf));
        ^
2018-08-21 23:11:08 +02:00
Aleksander Morgado da046fe566 plugin: new properties to support Intel XMM capability probing 2018-08-21 17:02:39 +00:00
Aleksander Morgado 82262117e6 port-probe: support probing for Intel XMM capabilities
Same thing as we do for Icera.
2018-08-21 17:02:39 +00:00
Aleksander Morgado 532ff24101 broadband-modem-mbim: implement 3GPP USSD support 2018-08-21 16:50:15 +00:00
Aleksander Morgado eda46d05cf charsets: new helper to convert binary input data to UTF-8
Most of all the other APIs we have are expecting binary data (e.g.
UCS-2 encoded strings) in ASCII hex format, because they were going
to be used in text AT commands. For binary protocols allowing binary
data, we need use a more generic API that provides an explicit data
size.
2018-08-21 16:50:15 +00:00
Aleksander Morgado e90ced5e0f iface-modem-3gpp-ussd: new helper to get current state 2018-08-21 16:50:15 +00:00
Aleksander Morgado d16a1711fd iface-modem-3gpp-ussd: prefer 'events' naming to 'result codes'
The 'result codes' naming is much more AT-protocol specific, 'events'
is more generic.
2018-08-21 16:50:15 +00:00
Aleksander Morgado 3bc9a2dbe2 broadband-modem,ussd: explain encoding/decoding logic 2018-08-21 16:50:15 +00:00
Aleksander Morgado 6838a3f715 broadband-modem,ussd: port to GTask 2018-08-21 16:50:15 +00:00
Aleksander Morgado fc41c167ce iface-modem-3gpp,ussd: let send_finish() return a newly allocated string
GTask integration will benefit from this change.
2018-08-21 16:50:15 +00:00
Aleksander Morgado 4ef3623e63 shared-qmi: refactor parse_as_utf16_url()
Let it return a GArray directly. We don't expect this method to ever
fail, as it's converting from UTF-8 to UTF-16.
2018-08-21 17:00:21 +02:00
Aleksander Morgado 6342088458 shared-qmi: fix context type in GPS operation mode timeout handler 2018-08-21 16:57:33 +02:00
Aleksander Morgado c9d1d0572a shared-qmi: inject "xtra data" if "predicted orbits data" unsupported 2018-08-21 13:26:08 +00:00
Aleksander Morgado efa14947b4 shared-qmi,loc: setup reports every 5s may be broken
Configuring reports every 5s may lead to GPGGA traces reported like this:

    $GPGGA,211645.00,,,,,0,,,,,,,,*4D
    $GPGGA,211646.00,4030.003988,N,00330.761876,W,1,07,1.0,691.6,M,53.0,M,,*74
    $GPGGA,211650.00,,,,,0,,,,,,,,*49
    $GPGGA,211651.00,4030.005405,N,00330.763540,W,1,07,1.0,688.9,M,53.0,M,,*71
    $GPGGA,211655.00,,,,,0,,,,,,,,*4C
    $GPGGA,211656.00,4030.008074,N,00330.765338,W,1,07,0.9,679.9,M,53.0,M,,*70
    $GPGGA,211700.00,,,,,0,,,,,,,,*4D
    $GPGGA,211701.00,4030.009258,N,00330.765510,W,1,07,1.0,678.3,M,53.0,M,,*71
    $GPGGA,211705.00,,,,,0,,,,,,,,*48

Which is totally undesirable, as the GPS location would be flapping
between set and unset.

Use the default of 1s explicitly, which behaves properly.
2018-08-21 13:26:08 +00:00
Aleksander Morgado 666622b4d4 broadband-modem-mbim: report Unsupported if QMI over MBIM not available
For non-Qualcomm MBIM devices, report a generic "Unsupported" error if
we try to do an operation that would otherwise be only available with
QMI-over-MBIM.
2018-08-21 13:26:08 +00:00
Aleksander Morgado d3b43bd0a6 shared-qmi: support for Qualcomm gpsOneXTRA assistance data
The gpsOneXTRA assistance data provides a convenient way to inject
predicted orbit information into the module, without requiring to have
an Internet connection in the module itself.
2018-08-21 13:26:08 +00:00
Aleksander Morgado 091bf4dbd8 api: support location assistance data
Sometimes SUPL-server based A-GPS is not possible, e.g. if the module
doesn't have Internet connectivity. In such cases, the modem may
support injecting additional "assistance data" that may be downloaded
from the Internet using external means (e.g. WiFi), in order to keep
having a quick time to first fix.

We now support using this location assistance data, with the following
new API elements:

 * A new mask of supported assistance data types is provided in the
   SupportedAssistanceData property.

 * A new list of URLs from where the aassistance data may be
   downloaded is also provided in a new AssistanceDataServers
   property.

 * A new InjectAssistanceData() method is provided, to perform the
   data injection in the module once it's been downloaded to the host
   system.
2018-08-21 13:26:08 +00:00
Aleksander Morgado 0798f32362 shared-qmi: implement LOC-based GPS/A-GPS support 2018-08-21 13:26:08 +00:00
Aleksander Morgado 8bc51d3ed1 shared-qmi: decouple low-level GPS operations from source management logic
Just to make room for the LOC based integration.
2018-08-21 13:26:08 +00:00
Aleksander Morgado fc520eb073 modem-helpers-qmi: new helper to transform QmiLocIndicationStatus into a GError 2018-08-21 13:26:08 +00:00