Commit Graph

130 Commits

Author SHA1 Message Date
Alexander Dahl
266e98e020 ublox: Mark ubandsel as unsupported on SARA-R4 and -N4
See log from a SARA-R410M-02B-01 before the change:

    Feb 01 05:40:01 unit ModemManager[304]: <debug> [1612158001.012330] [modem0/ttymxc4/at] --> 'AT+UBANDSEL?<CR>'
    Feb 01 05:40:01 unit ModemManager[304]: <debug> [1612158001.026831] [modem0/ttymxc4/at] <-- '<CR><LF>ERROR<CR><LF>'
    Feb 01 05:40:01 unit ModemManager[304]: <debug> [1612158001.027113] [modem0/ttymxc4/at] operation failure: 100 (Unknown error)
    Feb 01 05:40:01 unit ModemManager[304]: <warn>  [1612158001.027298] [modem0] couldn't load current bands: Unknown error

Backed by SARA-R4 series AT commands manual, no reference to +UBANDSEL
in the manual at all.

Log after the change:

    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500845] [modem0] (u-blox) support configuration found for 'SARA-R410M-02B'
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500961] [modem0] (u-blox)   band update requires explicit unregistration
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.501052] [modem0] (u-blox)   UACT based band configuration unsupported
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.501141] [modem0] (u-blox)   UBANDSEL based band configuration unsupported

Fixes: 437fb830c8 ("ublox,helpers: assume all SARA/LARA devices require COPS")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
2021-07-07 17:20:23 +02:00
Alexander Dahl
7c9d1e45be ublox: Add more values to URAT combinations
The SARA-R410M-02B-01 only supports values 7 and 8, log excerpt:

    Feb 01 05:40:00 unit ModemManager[304]: <debug> [1612158000.826046] [modem0/ttymxc4/at] --> 'AT+URAT=?<CR>'
    Feb 01 05:40:00 unit ModemManager[304]: <debug> [1612158000.833596] [modem0/ttymxc4/at] <-- '<CR><LF>+URAT: (7-8),(7-8)(7-8)<CR><LF><CR><LF>OK<CR><LF>'
    Feb 01 05:40:00 unit ModemManager[304]: <warn>  [1612158000.833992] [modem0] (u-blox) unexpected AcT value: 7
    Feb 01 05:40:00 unit ModemManager[304]: <warn>  [1612158000.834096] [modem0] (u-blox) unexpected AcT value: 8
    Feb 01 05:40:00 unit ModemManager[304]: <warn>  [1612158000.834193] [modem0] couldn't load supported modes: No combinations built from +URAT=? response

The SARA-R4 series AT commands manual (and also the SARA-R5 AT commands
manual) lists them like this:

- 7: LTE Cat M1
- 8: LTE Cat NB1

After the change, log looks like this:

    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.490627] [modem0/ttymxc4/at] --> 'AT+URAT?<CR>'
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.499994] [modem0/ttymxc4/at] <-- '<CR><LF>+URAT: 7,8<CR><LF><CR><LF>OK<CR><LF>'
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500433] [modem0] (u-blox) current allowed modes retrieved: 4g
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500561] [modem0] (u-blox) current preferred modes retrieved: 4g

Signed-off-by: Alexander Dahl <ada@thorsis.com>
2021-07-07 17:18:56 +02:00
Aleksander Morgado
8da8fd0248 api: update MMMobileEquipmentError enum values
Update the list of mobile equipment error codes according to v17.1.0
of 3GPP TS 27.007 (March 2021).

A lot of the enum values that were prefixed with the 'GPRS_' keyword
have now been flagged as deprecated, and a new enum name given to the
corresponding value.

The deprecated symbol names are kept in the compat support to avoid
breaking API/ABI.
2021-05-22 22:58:37 +00:00
Aleksander Morgado
887358663d broadband-bearer: rely on profile management for the cid selection
There is no longer need to perform all the CID selection logic in the
broadband bearer connection procedure, we can rely on the new profile
management operations to do the same thing.

We can do this because we're sure that all the MMBroadbandModem
objects implement the MMModem3gppProfileManager interface.

Additionally, given that we now provide the profile ID value as part
of the MMBearerConnectResult, we no longer need a custom
mm_broadband_bearer_get_3gpp_cid() as we can use the generic
mm_base_bearer_get_profile_id() for the same purpose.
2021-04-29 10:13:22 +00:00
Aleksander Morgado
5d176a1e61 base-modem: explicitly say if NET or TTY data ports are supported
A modem that creates exclusively bearer objects that work with NET
ports (e.g. all QMI or MBIM modems) must not add any TTY port in the
list of data ports.

A modem that creates exclusively bearer objects that work with TTY
ports (e.g. the generic modem) must not add any NET port in the
list of data ports.

A modem that may use both TTY and NET ports should add all in the list
of data ports.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/324
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/329
2021-03-04 18:03:28 +01:00
Aleksander Morgado
5d150ed23e core,plugins: consolidate connection/disconnection timeout values
Each different plugin or protocol had a different connection attempt
value. E.g. QMI and MBIM both used 60s max for the connection attempt,
while the u-blox plugin had up to 180s for ECM based connection
setups.

This commit consolidates all plugins and protocols to use the same
timeout values for commands that may take long to respond, e.g. a
connection atempt under low signal quality conditions.

A value of 180s for the connection attempt steps and 120s for a
disconnection attempt step is considered. Note, though, that in some
cases (like a IPv4v6 setup attempt using QMI) we may have more than
one such long step, so this doesn't mean that a connection attempt
will always take less than 180s.

Users of the connection/disconnection APIs should be able to handle
the case where the attempt times out in their side (e.g. with a lower
DBus request timeout), and which would not mean the actual request
they did really failed. E.g. a connection attempt with a DBus timeout
of 30s may fail in the user with a timeout error, but the attempt
would still go on for as much as the plugin/protocol needs.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/270
2020-11-14 09:41:43 +00:00
Aleksander Morgado
86a183778b api,sim: new 'Active' property
In preparation for the multi-SIM setup, we need a way to tell whether
a given SIM card is active or not in the system.

On systems with one single SIM slot, the available SIM card will
always be active.

On Multi-SIM Single-Standby setups we may have multiple SIM slots with
multiple SIM cards, but only one of them will be active at any given
time.

On Multi-SIM Multi-Standby setups we may have multiple SIM slots with
multiple SIM cards that may be active at the same time. E.g. the QMI
protocol allows up to 5 different active SIM cards (primary,
secondary, tertiary...).
2020-08-28 14:59:06 +00:00
Giacinto Cifelli
4d58278d7f changed default authentication algorithm to CHAP
CHAP is almost universal nowadays, and so it is a better default
than PAP

Not changed for uBlox, that prefers an error if not specified,
and for Huawei, which uses NONE with user/pwd and has 2 CHAP choices
2020-07-24 16:34:40 +02:00
Aleksander Morgado
71d65bbe7e u-blox: always ignore M8 and M9 GPS modules 2020-06-22 14:10:28 +02:00
Aleksander Morgado
bbeca60113 ublox: fully ignore GPS devices with plugin-installed rules
Instead of setting up the ID_MM_TTY_BLACKLIST tag used in 'legacy'
filter mode, tag all known u-blox GPS devices with the broader
ID_MM_DEVICE_IGNORE tag that applies under all filter modes.

Also, make this rules be installed by the plugin itself, because at
the end, it is the u-blox plugin the one attempting to probe all
devices with vid 0x1546.
2020-06-04 11:34:43 +02:00
Aleksander Morgado
ccf16e00a7 ublox,helpers: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  ublox/mm-modem-helpers-ublox.c: In function 'parse_bands_from_string':
  ublox/mm-modem-helpers-ublox.c:1612:48: error: cast increases required alignment of target type [-Werror=cast-align]
           tmpstr = mm_common_build_bands_string ((MMModemBand *)(bands->data), bands->len);
                                                  ^
2020-05-19 13:44:23 +02: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
e956bac47b log: common logging method definition for all testers and helpers 2020-04-08 17:53:42 +02:00
Aleksander Morgado
ccd0f6de5a ublox: port to use object logging 2020-04-08 16:35:10 +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
9bcadea172 log: new object logging support
So that we can provide the specific object id in every log associated
to a given object.
2020-04-08 16:35:08 +02:00
Aleksander Morgado
4a609e564a ublox: fix disabling of unsolicited events
The incorrect ready() method was being used while disabling, which
ended up making the parent disable not being run at all.

  ublox/mm-broadband-modem-ublox.c:1178:1: error: ‘voice_disable_unsolicited_events_ready’ defined but not used [-Werror=unused-function]
   1178 | voice_disable_unsolicited_events_ready (MMBroadbandModemUblox *self,
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
72a124a121 ublox: fix warnings with -Wimplicit-fallthrough
ublox/mm-broadband-modem-ublox.c:458:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    458 |         ctx->step++;
        |         ~~~~~~~~~^~
  ublox/mm-broadband-modem-ublox.c:461:5: note: here
    461 |     case SET_CURRENT_MODES_BANDS_STEP_ACQUIRE:
        |     ^~~~
  ublox/mm-broadband-modem-ublox.c:468:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    468 |         ctx->step++;
        |         ~~~~~~~~~^~
  ublox/mm-broadband-modem-ublox.c:471:5: note: here
    471 |     case SET_CURRENT_MODES_BANDS_STEP_CURRENT_POWER:
        |     ^~~~
  ...
2020-01-31 15:18:35 +01:00
Aleksander Morgado
3197a52c58 ublox: fix warnings with -Wswitch-enum
ublox/mm-broadband-modem-ublox.c:1246:5: error: enumeration value ‘MM_CALL_STATE_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   1246 |     switch (call_info.state) {
        |     ^~~~~~
  ublox/mm-broadband-modem-ublox.c:1246:5: error: enumeration value ‘MM_CALL_STATE_ACTIVE’ not handled in switch [-Werror=switch-enum]
  ublox/mm-broadband-modem-ublox.c:1246:5: error: enumeration value ‘MM_CALL_STATE_HELD’ not handled in switch [-Werror=switch-enum]
  ublox/mm-broadband-modem-ublox.c:1246:5: error: enumeration value ‘MM_CALL_STATE_TERMINATED’ not handled in switch [-Werror=switch-enum]
2020-01-31 15:18:35 +01:00
Aleksander Morgado
d6ec29c49e ublox: fix warnings with -Wswitch-default
ublox/mm-broadband-modem-ublox.c: In function ‘preload_support_config’:
  ublox/mm-broadband-modem-ublox.c💯5: error: switch missing default case [-Werror=switch-default]
    100 |     switch (self->priv->support_config.method) {
        |     ^~~~~~
  ublox/mm-broadband-modem-ublox.c:112:5: error: switch missing default case [-Werror=switch-default]
    112 |     switch (self->priv->support_config.uact) {
        |     ^~~~~~
  ublox/mm-broadband-modem-ublox.c:123:5: error: switch missing default case [-Werror=switch-default]
    123 |     switch (self->priv->support_config.ubandsel) {
        |     ^~~~~~
  ublox/mm-broadband-modem-ublox.c: In function ‘set_current_modes_bands_step’:
  ublox/mm-broadband-modem-ublox.c:452:5: error: switch missing default case [-Werror=switch-default]
    452 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
a1966222e9 ublox: use common re-registration logic when needed
If the modem requires +COPS re-registration after setting bands or
modes, use the common logic provided by the 3GPP interface, which
already knows e.g. whether the registration was automatic or the
actual requested operator id in case of being manual.

This will also make the u-blox plugin use the common +COPS set command
implemented in the broadband modem object, which has the fallback to
use the MCCMNC encoded in the current charset if needed.
2020-01-06 20:17:08 +00:00
Aleksander Morgado
7d1e949137 ublox: ignore error when disconnecting last LTE bearer
This is required in the TOBY-L2 and TOBY-L4 modules in order to report
a proper disconnection, even if there is none in reality. The default
LTE bearer is always reported connected while registered in LTE.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/166
2019-12-16 14:39:22 +01:00
Aleksander Morgado
42aa9cc2f6 ublox: implement support to enable and detect +UUDTMF URCs
Also, make sure we enable/disable the voice related unsolicited events
in both primary and secondary ports, because it may happen that the
primary port is connected with PPP and we're using the secondary port
for control.
2019-12-05 15:48:55 +01: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
Aleksander Morgado
dcf50efdd5 ublox: fix calling setup_unsolicited_events_finish() 2019-09-23 18:14:23 +02:00
Aleksander Morgado
141e69bc00 plugins,tests: setup new helper utilities for tests
For now, including a handy method from the ublox tests that allows
comparing arrays of bands that may not be sorted.
2019-09-09 12:24:43 +02:00
Aleksander Morgado
fca8955721 ublox: +UCALLSTAT as device-level URC, not in-call
+UCALLSTAT is used to report the state of specific calls by index, and
therefore this is not an in-call URC.
2019-07-11 23:21:00 +02:00
Aleksander Morgado
ed7be29111 broadband-modem,voice: disable unsolicited events 2019-07-11 23:00:50 +02:00
Aleksander Morgado
ca5f2e8b3e ublox,tests: expect error if empty band list when parsing UACT? 2019-06-13 11:28:26 +02:00
Aleksander Morgado
20c5d7fd92 ublox: return error when no bands are parsed
If load_current_bands_finish() returns a NULL GArray, we must set the
GError or otherwise the daemon will segfault when the caller
dereferences the GError:

    current_bands = MM_IFACE_MODEM_GET_INTERFACE (self)->load_current_bands_finish (self, res, &error);
    if (!current_bands) {
        /* Errors when getting current bands won't be critical */
        mm_warn ("couldn't load current Bands: '%s'", error->message);
        g_error_free (error);
    }

This may happen with an empty but balid +UACT response, e.g.:
   AT+UACT?
   +UACT: ,,,
   OK

Or when it replies a full empty string:
   AT+UACT?
   OK
2019-06-13 10:26:53 +02:00
Sven Schwermer
7e4a8d9566 ublox: add LISA/SARA-U2 alternative port types
When configuring these modems with AT+UUSBCONF=2, i.e. CDC-ECM + 4x
CDC-ACM, they also enumerate with a different PID on the USB. We need to
adjust the udev rules for that case in order to ignore the non-AT ports.

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2019-04-03 13:17:19 +02:00
Ben Chan
43d454ab7f ublox: fix out-of-bounds array accesses
This patch fixes several invalid checks like this:

   array[i] && i < G_N_ELEMENTS (array)

which should instead be:

   i < G_N_ELEMENTS (array) && array[i]

to avoid an out-of-bounds access of the array.

Fixes: c1aa658802
2019-03-29 13:34:10 -07:00
Aleksander Morgado
0944e59252 ublox: parse +UGCNTRD stats as unsigned 64bit values
[1551646332.583651] (ttyACM2): --> 'AT+UGCNTRD<CR>'
  [1551646332.626567] (ttyACM2): <-- '<CR><LF>+UGCNTRD: 1,0,0,0,0<CR><LF><CR><LF>+UGCNTRD: 2,1397316870,113728263578,1397316870,113728263578<CR><LF><CR><LF>OK<CR><LF>'
  [1551646332.627120] Reloading stats failed: Couldn't load primary PDP context 2 statistics: Error parsing session RX bytes
2019-03-29 10:07:29 +00:00
Aleksander Morgado
0f6f89801e ublox: fix parser to report only bands supported by the module
We were filtering the 4G bands supported by the module when parsing
+UBANDSEL responses, e.g. so that we would not reply unsupported bands
for a given ubandsel value.

But we need the same filtering in 2G and 3G bands, because for example
some modules may support a specific 4G band with a given ubandsel
value, but NOT the associated 3G band. E.g. the TOBY-R200 supports
EUTRAN-4 but not UTRAN-4.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
278a72643a ublox,tests: fix R-200 UBANDSEL response tester 2019-01-30 12:10:03 +01:00
Aleksander Morgado
74bdc97b34 ublox: use fixed array sizes when iterating 2019-01-30 12:10:03 +01:00
Aleksander Morgado
8b9053822b ublox: fix loop looking for a specific 4g band value
We cannot have the ubandsel value comparision inside the for(;;) stop
conditions, because that would mean the loop would stop whenever the
comparison fails. We want to look for a value, so we need to loop the
whole array and stop once we find it only.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
36b5e1ee20 ublox: the whole list of supported bands is known
So, assert() if for any reason we're asking to use a band that we
don't find in the list.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
fec1c43f80 ublox: don't create array with totally unrelated size 2019-01-30 12:10:03 +01:00
Aleksander Morgado
de5b9e441f ublox: coding style fixes 2019-01-30 12:10:03 +01:00
Aleksander Morgado
d8cf219644 ublox,helpers: remove unit tests for supported bands
We're hardcoding the supported bands for each u-blox model, so there
really is no point in having unit tests for them.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
437fb830c8 ublox,helpers: assume all SARA/LARA devices require COPS 2019-01-30 12:10:03 +01:00
Aleksander Morgado
ea01ac73e2 ublox: COPS based registration requests with 120s AT command timeout 2019-01-30 12:10:03 +01:00
Aleksander Morgado
1d7f2c1a61 ublox: initial power state logic only required when CFUN used
When we're changing modes or bands, we only need to keep track of the
initial power state when CFUN=4/CFUN=1 based logic is used. When using
COPS, we do not need to track initial power state or recover it after
the operation.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
d12b919787 ublox,helpers: fix missing ubandsel support initializations 2019-01-30 12:10:03 +01:00
Aleksander Morgado
b1d69a69f9 ublox,helpers: rename enum
We're not going to use CFUN/COPS just for bands, but also for modes,
so use more generic names.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
308d9e4ddb ublox: fix band setting operation
If both UBANDSEL and UACT are unsupported, we were not initializing
the command variable.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
2677524f6a ublox: fix current bands loading completion
If both UACT and UBANDSEL are unsupported, the async operation was
never completed.
2019-01-30 12:10:03 +01:00
Aleksander Morgado
c3f4fe063f ublox: rework support config loading
Make mm_ublox_get_support_config() return FALSE only when GError is
set. And also, prepare a preload_support_config() method to be run
before using any information from the support configuration (i.e.
don't do it in load_supported_bands(), do it in load_current_bands()
or in set_current_bands().
2019-01-30 12:10:03 +01:00