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