Commit Graph
40 Commits
Author SHA1 Message Date
Aleksander Morgado 6eca223705 shared-qmi: require minimum set of NMEA types before starting GNSS engine 2020-06-01 15:43:48 +00:00
Aleksander Morgado 2293fbe6ba shared-qmi: include all possible 5G related combinations if SSP is supported 2020-04-09 12:38:50 +00:00
Aleksander Morgado bca5c5e423 modem-helpers-qmi: port qmi capabilities parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 07b492c887 modem-helpers-qmi: port acquisition order preference parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado f03fb06d8e modem-helpers-qmi: port qmi interface parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado fc76e797d7 modem-helpers-qmi: port qmi band parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 0f708daf0b modem-helpers: port supported modes filtering to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 6dff5ba673 shared-qmi: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado f1126d535b shared-qmi: fix warnings with -Wswitch-enum
mm-shared-qmi.c: In function ‘pds_set_default_tracking_session_ready’:
  mm-shared-qmi.c:4209:5: error: enumeration value ‘GPS_OPERATION_MODE_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   4209 |     switch (ctx->mode) {
        |     ^~~~~~
  mm-shared-qmi.c: In function ‘loc_location_set_operation_mode_indication_cb’:
  mm-shared-qmi.c:4354:5: error: enumeration value ‘GPS_OPERATION_MODE_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   4354 |     switch (ctx->mode) {
        |     ^~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado 8defd21bc4 shared-qmi: fix warnings with -Wsign-compare
mm-shared-qmi.c: In function ‘get_config_info_indication’:
  mm-shared-qmi.c:2843:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   2843 |     for (i = 0; i < ctx->config_list->len; i++) {
        |                   ^
  mm-shared-qmi.c:2850:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   2850 |     if (i == ctx->config_list->len)
        |           ^~
  mm-shared-qmi.c: In function ‘list_configs_indication’:
  mm-shared-qmi.c:2927:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   2927 |     for (i = 0; i < configs->len; i++) {
        |                   ^
2020-01-30 11:59:14 +01:00
Aleksander Morgado 25ea9d9bdd shared-qmi: fix warnings with -Wswitch-default
mm-shared-qmi.c: In function ‘set_current_capabilities_step’:
  mm-shared-qmi.c:601:5: error: switch missing default case [-Werror=switch-default]
    601 |     switch (ctx->step) {
        |     ^~~~~~
  mm-shared-qmi.c: In function ‘load_current_capabilities_step’:
  mm-shared-qmi.c:868:5: error: switch missing default case [-Werror=switch-default]
    868 |     switch (ctx->step) {
        |     ^~~~~~
  mm-shared-qmi.c: In function ‘setup_carrier_config_step’:
  mm-shared-qmi.c:2473:5: error: switch missing default case [-Werror=switch-default]
   2473 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado cc4e7f6cfd shared-qmi: fix NAS SSP support check during supported caps loading 2019-10-14 12:44:47 +02:00
Ben Chan 500844af73 shared-qmi: fix potentially uninitialized 'mcc' variable
mm-shared-qmi.c:358:9: error: variable 'mcc' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
    if (operator_id && !mm_3gpp_parse_operator_id (operator_id, &mcc, &mnc, &error)) {
        ^~~~~~~~~~~
mm-shared-qmi.c:367:9: note: uninitialized use occurs here
    if (mcc) {
        ^~~
mm-shared-qmi.c:358:9: note: remove the '&&' if its condition is always true
    if (operator_id && !mm_3gpp_parse_operator_id (operator_id, &mcc, &mnc, &error)) {
        ^~~~~~~~~~~~~~
mm-shared-qmi.c:339:51: note: initialize the variable 'mcc' to silence this warning
    guint16                                    mcc;
                                                  ^
                                                   = 0
2019-07-26 17:04:30 -07:00
Aleksander Morgado 22afa8a74e shared-qmi: monitor attempt after NAS initiate network register
The QMI NAS Initiate Network Register command will return a successful
response when the request to register is received and accepted by the
module, but this does not mean the requested registration has been
completed yet.

This issue was making e.g. manual registration attempts to a forbidden
network report success right away, even if the actual registration
would end up failing.

In order to avoid that, the QMI based network registration relies on
receiving QMI NAS Serving System indications after QMI NAS Initiate
Network Register replies. As soon as we get a non-searching
registration state in the indication, we'll report the operation as
successful.

Note that the 3GPP interface logic is anyway in charge of checking
if the specific request was successful or not, no need to do that
explicitly in the QMI implementation.
2019-07-15 04:43:54 +00:00
Aleksander Morgado de1ae549fa shared-qmi: config list may be empty
Reported by: Enrico Mioso <mrkiko.rs@gmail.com>
2019-04-15 10:43:59 +02:00
Aleksander Morgado 791c582df3 shared-qmi: implement support for MSB A-GPS 2019-04-09 12:24:39 +00:00
Aleksander Morgado b77aa7ab0e location,agps: explicitly specify that MSA A-GPS is implemented
The A-GPS based implementations we currently have assume MSA A-GPS, so
rename the MMModemLocationSource enum value to reflect that.
2019-04-09 12:24:39 +00:00
Dan Williams 88fac7f14a build: fix -Wunused-but-set-variable support and handle clang better
By default the build used -Wno-unused-but-set-variable but that's
clearly not what we want. Fix those problems.

When using clang, the compiler doesn't error on unknown compile
options, so let's add -Werror to the checking too.

CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
2019-04-02 10:48:40 -05:00
Aleksander Morgado 093174c84d shared-qmi: always use newest carrier config if more than one found 2019-04-02 12:14:03 +02:00
Aleksander Morgado c09e8c8a2a shared-qmi: if requested config not installed, fallback to generic
If there is a known match for a specific config, but the config is not
available in the module, we should fallback to the generic
configuration.
2019-04-02 12:14:03 +02:00
Aleksander Morgado 0029f846cd shared-qmi: no active carrier config means default is in use
In addition to any installed MCFG file, the firmware itself as a
'default' config that will be selected when no carrier config is
installed.

So it is not an error if 'QMI PDC Get Selected Config' doesn't return
the 'Active ID' TLV, it just means the default one is selected.
2019-04-02 12:14:03 +02:00
Aleksander Morgado 52b67dc7c3 api,modem: new 'CarrierConfigurationRevision' property
Which reports the version of the currently active carrier
configuration.

We also update the firmware 'version' reported in the firmware
settings so that carrier-specific upgrades can be performed (e.g. when
the firmware stays the same but the MCFG is updated).
2019-04-02 12:14:03 +02:00
Aleksander Morgado b4b6dc9e65 shared-qmi: implement QMI PDC based carrier config support
We implement both loading the current configuration in use, as well as
automatically switching to a different one if a mapping file is
available.
2019-04-02 12:14:03 +02:00
Aleksander Morgado c7d5902c15 shared-qmi: implement support for the 'extended' LTE band list
This will allow us to configure via mmcli devices that support LTE
bands that would not fit in the standard TLVs (e.g. band 66 below)
or bands which aren't really reported in the standard TLVs (e.g. bands
46 and 48 below).

  $ sudo qmicli -d /dev/cdc-wdm0 -p --dms-get-band-capabilities
  [/dev/cdc-wdm0] Device band capabilities retrieved:
      Bands: 'wcdma-2100, wcdma-pcs-1900, wcdma-1700-us, wcdma-850-us, wcdma-800, wcdma-900, wcdma-1700-japan, wcdma-850-japan'
      LTE bands: '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 38, 39, 40, 41, 42, 43'
      LTE bands (extended): '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 38, 39, 40, 41, 42, 43, 46, 48, 66'
2018-10-09 16:04:26 +02:00
Aleksander Morgado d1744c7663 shared-qmi: reuse band management logic in MBIM whenever possible 2018-09-12 17:25:19 +00:00
Aleksander Morgado ac69466c9d shared-qmi: implement 3GPP network registration logic
Ported from the broadband modem QMI implementation, keeping the logic
in place. We will need this to integrate mode/capability switching in
MBIM devices, for nothing else really (as MBIM already supports this
operation).
2018-09-12 17:25:19 +00:00
Aleksander Morgado 692d076ba6 shared-qmi: implement reworked mode and capabilities management
This commit introduces several improvements and changes in the way
modes and capabilities are managed in QMI capable devices. It is
organized into a single commit, as all changes in all 6 operations
(load current capabilities, load supported capabilities, set current
capabilities, load supported modes, load current modes, set current
modes) are related one to the other (given that the same QMI commands
are used for both capabilities and mode management).

The primary change is related to which capabilities are reported as
supported for a given device. In the previous implementation we
allowed switching between every combination possible for GSM/UMTS+LTE,
CDMA/EVDO+LTE or GSM/UMTS+CDMA/EVDO+LTE devices. E.g. we would allow
"LTE only" and "GSM/UMTS only" capabilities for GSM/UMTS+LTE devices,
even if they would both be managed in exactly the same way. That setup
wasn't ideal, because it meant that switching to a "LTE only"
configuration would require a power cycle, as capability switching
requires a power cycle, even if no change was expected in the exposed
DBus interfaces (which is why we require the power cycle). So, instead
of allowing every possible capability combination, we use capability
switching logic exclusively for configuring GSM/UMTS+CDMA/EVDO devices
(regardless of whether it has LTE or not) to add or remove the
GSM/UMTS and CDMA/EVDO capabilities. E.g. for a GSM/UMTS+CDMA/EVDO+LTE
device we would allow 3 combinatios: "GSM/UMTS+LTE", "CDMA/EVDO+LTE"
and "GSM/UMTS+CDMA/EVDO+LTE".

The "GSM/UMTS+CDMA/EVDO+LTE" is a special case because for this one we
allow switching to "LTE only" capabilities while we forbid switching
to "4G only" mode. As the same commands are used for mode and
capability switching, if we didn't have "LTE only" and we allowed "4G
only" mode instead and rebooted the device, we would end up not being
able to know which other capabilities (GSM/UMTS or CDMA/EVDO or both)
were also enabled.

Now that we have capability switching confined to a very subset of
combinations, we can use the mode switching logic to e.g. allow "4G
only" configurations in all non multimode devices, as well as masks of
allowed modes with one being preferred, which we didn't allow before.
In the previous implementation all mode switching logic was disabled
for LTE capable QMI devices. In the new implementation, we use the
"Acquisition Order Preference" TLV in NAS Set System Selection
Preference to define the full list of mode preferences for all
supported modes.

We also no longer just assume that NAS Technology Preference is always
available and NAS System Selection Preference only after NAS >= 1.1.
This logic is flawed, instead we're going to probe for those features
once when loading current capabilities, and we then just implement the
capabilities/mode switching logic based on that.
2018-09-12 17:25:19 +00:00
Aleksander Morgado 6026c99f2e shared-qmi: reuse device factory reset logic in MBIM whenever possible 2018-09-12 17:25:19 +00:00
Aleksander Morgado 9dc26cc44d shared-qmi: reuse device reset logic in MBIM whenever possible 2018-09-12 17:25:19 +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
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 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 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 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 098897778b shared-qmi: import PDS-based GPS location support 2018-08-21 13:26:08 +00:00
Aleksander Morgado 811a80e5ea shared-qmi: new interface to handle common QMI implementations
This new interface will include implementations that are shared
between the MMBroadbandModemQmi and the MMBroadbandModemMbim.

For now, it just provides a way to implement the common client
allocation methods.
2018-08-21 13:26:08 +00:00