Commit Graph
4367 Commits
Author SHA1 Message Date
Bjørn Mork 7bbf6c8a4a mm-netlink: only change IFF_UP flag
This fixes the missing NOARP flag on the second and following VLAN
sub-interfaces when multiplexing over the cdc_mbim driver.

ifi_change specifies all the flags we want to change. Any listed
flag which isn't set in ifi_flags will be cleared by the kernel:

        if (ifm->ifi_change)
                flags = (flags & ifm->ifi_change) |
                        (rtnl_dev_get_flags(dev) & ~ifm->ifi_change);

Drivers like cdc_mbim set some netdev flags by default, indicating
supported or unsupported features. The driver emulates an ethernet
netdev but it doesn't implement ARP.  Clearing NOARP on cdc_mbim
netdevs will block IP transmissions, waiting for an ARP reply we
never will receive.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2022-03-28 13:25:07 +02:00
Freedom Liu a56f96f074 foxconn: use new qmi service(fox) to get firmware version
foxconn modules get firmware version:
Try with the new FOX service first. If FOX service failed, try with DMS service.
T99W175(vid:105b) ; T77W968(0489:e0b4 ; 0489:e0b5):
    qmi service: dms
T99W265(0489:e0da ; 0489:e0db):
    qmi service: fox
2022-03-28 08:06:10 +00:00
Stephan Gerhold 8d95c82f9c shared-qmi: ignore slot status indications until initial status is known
Recent ModemManager versions no longer work on the Samsung A5 (Qualcomm
MSM8916) smartphone: MM ends up in an infinite loop trying to probe the
modem over and over again.

Looking at the debug log it seems to be related to a "Slot Status"
indication that comes in during probe time and causes MM to restart
the probing process:

    [/dev/wwan0qmi0] Sent generic request (translated)...
      << QMUX: service = "uim"
      << QMI: message = "Register Events" (0x002E)
      << TLV: translated = physical-slot-status
    [/dev/wwan0qmi0] Received generic indication (translated)...
      << QMUX: service = "uim"
      << QMI: message = "Slot Status" (0x0048)
      << TLV: translated = { [0] = '[ physical_card_status = 'present', ...
    [/dev/wwan0qmi0] Received generic response (translated)...
      << QMUX: service = "uim"
      << QMI: message = "Register Events" (0x002E)
      << TLV: translated = SUCCESS
    [modem42] registered for slot status indications
    [/dev/wwan0qmi0] Sent generic request (translated)...
      << QMUX: service = "uim"
      << QMI: message = "Get Slot Status" (0x0047)
    [modem42] received slot status indication
    [modem42] An active slot had a status change, will reprobe the modem
     <infinite loop>

The "Slot Status" indication (uim_slot_status_indication_cb) arrives
immediately after starting to listen for the event, which is before
ModemManager has actually loaded the initial slot status in
uim_get_slot_status_ready. In this situation !slot_array_status_equal()
will always cause the modem to reprobe, even though it is not necessary
during the probe phase.

To fix this add a simple check to uim_slot_status_indication_cb() that
ignores the indication if the initial slot status was not loaded yet.
2022-03-23 20:39:14 +01:00
Aleksander Morgado 8ab31cf0e6 broadband-modem-mbim: consolidate initialized SIM creation method
The logic to create a new SIM object from the slot status info was
used in several places.
2022-03-22 21:53:08 +00:00
som 035879dab9 broadband-modem-mbim: update sim-type and esim-status of inactive slot
During initialization if the number of slots is more than 1 then
update the sim-type and esim-status of the inactive slot as well.
2022-03-22 21:53:08 +00:00
Aleksander Morgado 598d99b5bd test,modem-helpers: add test for the EM9191 COPS=? response
Including 5GNR network reporting (act=12)

https://forum.sierrawireless.com/t/5g-network-scan-with-the-em9191-operation-not-allowed/26374/9
2022-03-16 11:04:06 +00:00
Aleksander Morgado 2c8cfb4768 modem-helpers: improve and fix COPS=? numeric fields parsing
The numeric fields in the +COPS=? response were relying on a very weak
parsing logic, assuming that they were single-digit numeric values and
not using the common string to integer conversion utilities.

This commit improves the conversion from the 3GPP/ETSI defined network
availability and access technology values to the MM defined ones,
providing enum-based matches even if the numeric values are the same.

The commit also fixes the parsing of access technology values > 10,
required to report 5G related values.
2022-03-16 11:04:06 +00:00
Aleksander Morgado 5ba67aff82 modem-helpers: act given in COPS=? may have more than one digit
The new 5GNR related values are >= 10, so don't expect one single
digit (\d), expect one or more (\d+).
2022-03-16 11:04:06 +00:00
Sven Schwermer 95eef34d37 modem-helpers: Consider minimum ID when choosing best profile
+CGDCONT? may list profiles with IDs that are illegal to write, i.e.
+CGDCONT=? returns a minimum ID larger than some of the existing
profiles. E.g. for Fibocom L610-EU, +CGDCONT=? returns

+CGDCONT: (1-7),"IP",,,(0-3),(0-4)
+CGDCONT: (1-7),"IPV6",,,(0-3),(0-4)
+CGDCONT: (1-7),"IPV4V6",,,(0-3),(0-4)
+CGDCONT: (1-7),"PPP",,,(0-3),(0-4)
+CGDCONT: (1-7),"Non-IP",,,(0-3),(0-4)

while the default EPS bearer is established at profile 0:

+CGDCONT: 0,"IP","xxx","xxx.xxx.xxx.xxx",0,0
[...]

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2022-03-09 22:43:20 +00:00
Prakash Pabba 92db190f37 mm-shared-qmi: Return an error in load_current_capabilities() if none is found. 2022-03-09 14:01:23 +00:00
Aleksander Morgado f7656de128 broadband-bearer: remove unused cid_selection_3gpp() method
It was replaced by the profile management operations instead in the
1.18 release.
2022-03-08 21:16:06 +01:00
Aleksander Morgado 343f27a5e7 api: allow tagging AT ports as GPS control
There are devices with multiple AT ports where only one of them is
supposed to be used for GNSS control (and data).
2022-03-07 09:51:43 +00:00
Iñigo Martínez 81c3b59f75 build,meson: Fix daemon enums dependencies
meson generates the `mm-daemon-enums-types` source and header files.
These are used when building `ModemManager` executable and different
plugins. However, these enums are only stated as dependencies on the
`ModemManager` executable build.

This has been fixed by also adding the generated files targets as
dependencies in the required plugins.
2022-03-01 09:27:08 +01:00
Iñigo Martínez 2bc697ce32 plugins: Fix port enums includes
The `broadmobi`, `dlink`, `telit` and `tplink` plugins include the
`mm-port-enums-types.h` header. However, they do not use any symbol
defined there.

The `huawei` plugin as includes the `mm-port-enums-types.h` header
but it does not include the build targets as dependencies.

These issues have been fixed by removing the unnecessary includes
from `broadmobi`, `dlink`, `telit` and `tplink` plugins and by
including the enums build target in the `huawei` target.
2022-03-01 09:24:37 +01:00
Aleksander Morgado 17dca109dd broadband-modem-qmi: avoid the deprecated QmiMessageDmsGetStoredImageInfoInput type 2022-02-28 21:54:24 +01:00
Aleksander Morgado 18aa526f8c shared-qmi: use the new QmiSlotEidElement type
This type was introduced to avoid having GArrays of GArrays in libqmi.
2022-02-28 21:54:24 +01:00
Aleksander Morgado a21b7740d8 shared-qmi: avoid the deprecated QmiConfigTypeAndId type
This type was a JSON description bug in libqmi, it should have never
been a struct by itself. This was changed in libqmi by the 1.31.3
snapshot, so let's use the new methods instead of the deprecated ones.
2022-02-28 21:54:24 +01:00
Michal Mazur 5ead5875d7 broadband-modem-mbim: include puk locks in facilities
The MBIM command PIN LIST returns only status of pin locks and omits
puk-locked facilities. This caused the pop-up window for unlocking
PUK is not shown after reboot.
Currenty active PUK lock has to be obtained using additional call
for PIN command but only single facility is supported this way.
2022-02-17 20:27:17 +00:00
Michal Mazur a719cb26f4 modem-helpers-mbim: add pin type to 3gpp facility converter 2022-02-17 20:27:17 +00:00
Aleksander Morgado 27f6679aa8 charsets: set error if UTF-8 validation fails
Otherwise, mm_modem_charset_bytearray_to_utf8() may return NULL
without error set, and that will trigger a crash in the caller.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/511
2022-02-17 09:59:24 +01:00
Aleksander Morgado 6aec0a6c80 sim-mbim: report error if decoding EID from APDU response fails
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/510
2022-02-16 21:48:19 +01:00
Aleksander Morgado 45102fcd60 iface-modem-signal: polling and thresholds only in effect if modem enabled
If the modem is disabled:
 * Polling is completely halted.
 * Thresholds are disabled.
 * The user is allowed to call Setup() or SetupThresholds() to change
   the settings, even if the actual polling or thresholds setup isn't
   in effect.

When the modem is enabled:
 * Polling will be started if there is a existing polling rate.
 * Thresholds will be setup based on the existing threshold settings.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/504
2022-02-16 11:28:03 +00:00
Dylan Van Assche 90397fa1bb iface-modem-firmware: expose device id builder
Expose the generic device id method as a public API for plugins.
Plugins can call this method first and then add their own device ids on
top in case the generic ones aren't specific enough like in the case of
Quectel modems.
2022-02-08 19:33:56 +01:00
Aleksander Morgado 967d748f04 sim-mbim: don't crash if SIM IMSI not provided
E.g. if we have an eSIM without profiles.
2022-02-01 10:35:56 +01:00
Aleksander Morgado 5cf15b3f6f broadband-modem-mbim: treat update in eSIM profiles list as a SIM hotplug event 2022-01-31 23:12:46 +01:00
Aleksander Morgado 8ae31be1be broadband-modem-mbim: minor alignment fix 2022-01-31 23:11:11 +01:00
Aleksander Morgado 9c08e54fb9 shared-qmi: filter out modes not currently available
Do not build the mask of "all" modes based only on the supported radio
interfaces, also filter out those modes that would not be available
based on the current capabilities enabled.
2022-01-31 22:48:57 +01:00
Aleksander Morgado c7ff014e07 modem-helpers-qmi: multimode devices shouldn't always have 4G/5G only modes
In GSM/UMTS+CDMA/EVDO multimode devices, the 4G and 5G mode switching
operations are exclusively limited to the capability selection that
has LTE+5GNR exclusively.

We cannot allow switching to 4G-only, 5G-only or 4G+5G if the current
capabilities have GSM/UMTS or CDMA/EVDO.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/503
2022-01-31 22:48:57 +01:00
Aleksander Morgado ccf0b7eba2 tests,modem-helpers-qmi: add tests for supported modes loading 2022-01-31 22:48:57 +01:00
Aleksander Morgado b323a73137 modem-helpers-qmi: new helper to build array of supported modes 2022-01-31 22:48:57 +01:00
Aleksander Morgado 6efde10714 tests,modem-helpers-qmi: add additional tests for supported capabilities loading
Including tests for 5G-only and non-multimode 5G+4G and 5G+4G+3G devices.
2022-01-31 22:48:57 +01:00
Aleksander Morgado ff51fe637d tests,modem-helpers-qmi: add tests for supported capabilities loading 2022-01-31 22:48:57 +01:00
Aleksander Morgado d0c87c5877 modem-helpers-qmi: new helper to build array of supported capabilities 2022-01-31 22:48:57 +01:00
Aleksander Morgado f370c096ec modem-helpers-qmi: refer explicitly to current capabilities in helper method
The helper method for which we have unit tests available refers
exclusively to the current capabilities loading, so rename it to
clarify that.
2022-01-31 22:48:57 +01:00
Prakash Pabba 2322988855 test-modem-helpers-qmi: add unit test for generic 5g modem 2022-01-30 15:37:05 +00:00
Prakash Pabba 3a1390f1dd test-modem-helpers-qmi: Fix tests for UML290
Change due to update in current capabilities loading logic.
2022-01-30 15:37:05 +00:00
Prakash Pabba 38f067c4e4 mm-shared-qmi,mm-modem-helpers: Fix supported capabilities and modes for multimode device
We use capability switching logic exclusively for configuring GSM/UMTS+CDMA/EVDO devices
(regardless of whether it has LTE/5GNR or not) to add or remove the GSM/UMTS and CDMA/EVDO
capabilities.

Based on the same logic, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE+5GNR device:
"GSM/UMTS+CDMA/EVDO+LTE+5GNR", "GSM/UMTS+LTE+5GNR", "CDMA/EVDO+LTE+5GNR" and "LTE+5GNR"

Similarly, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE device:
"GSM/UMTS+CDMA/EVDO+LTE", "GSM/UMTS+LTE", "CDMA/EVDO+LTE" and "LTE"

And, we will allow 3 combinations for GSM/UMTS+CDMA/EVDO device:
"GSM/UMTS+CDMA/EVDO", "GSM/UMTS" and "CDMA/EVDO"

Also, supported combination modes should be based on current capabilities and not entirely
upon supported radio interfaces.

1) If current capability has "gsm-umts" or "cdma-evdo" or both, do not
   support 4G only, 5G only, or 4G+5G combination modes
2) If current capability neither has "gsm-umts" nor "cdma-evdo", only support
   combination modes involving 4G and 5G.
2022-01-30 15:37:05 +00:00
Prakash Pabba f05258e757 mm-modem-helpers-qmi: Fix current capabilities for multimode device
Keep LTE or 5GNR always in current capabilities if supported by device.

Since capability switching logic is exclusively used for configuring
GSM/UMTS+CDMA/EVDO devices, decide if to have GSM/UMTS or CDMA/EVDO or both
or none when loading current capabilities.
2022-01-30 15:37:05 +00:00
Michal Mazur 9843546a49 iface-modem: make update_unlock_retries method static 2022-01-30 13:48:48 +00:00
Michal Mazur 5d4957935b sim-mbim,broadband-modem-mbim: store number of remaining attempts
On MBIM modems the type of PIN cannot be specified in MBIM_CID_PIN query
command and the modem responds only remaining attempts for the currently
active lock.
If PIN1 is unlocked and user tries to disable (or enable) it, MM won't
get an update of remaining attempts in response to PIN Query. This value
is returned only after the Set command and MM need to store it in
all (pin/puk)_set_(enter/enable/change)_ready functions.

Previous solution was to call the mm_iface_modem_update_unlock_retries
directly from these functions but it caused the notification to be send
too early and invalid number was displayed to user sometimes.
Instead of this MM will store numbers of remaining attempts and send
them in a single notification from modem_load_unlock_retries.
2022-01-30 13:48:48 +00:00
Michal Mazur ee87a68532 Revert "mm-sim-mbim: Remove update of remaining attempts"
This reverts commit 46c5cd8b72.
2022-01-30 13:48:48 +00:00
Nagi Marupaka 73e3da3a10 mm-kernel-device-helpers: fix memory leak
Newly refactored string manipulation function is leaking memory as per
our tests. This submission fixes that memory leak.
2022-01-26 18:27:09 +00:00
Aleksander Morgado 86496bd326 plugin-manager: longer extra probing time when not using udev
When using udev, we rely on the kernel to timely report port additions
in the same device.

When not using udev, e.g. when using hotplug scripts in openwrt, we
use mmcli --report-kernel-event operations to report the port
additions, which may end up requiring much more time to process,
especially during bootup as we would be reporting a lot of port
addition events one after the other.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/493
2022-01-22 21:03:48 +01:00
Aleksander Morgado 11b7aa46cb broadband-modem-qmi: minor code reordering in profile manager setup/cleanup/enable/disable
The finish() method with the GTask result propagation must be in the
same context as the GTask creation itself, not elsewhere.

Code is reordered so that the async methods can be read from bottom to
top, with the finish() method that includes the GTask result
propagation at the very top.
2022-01-22 10:35:54 +01:00
Florence Chan 6b9709245d mm-broadband-modem-qmi: implement ProfileManager.Updated signal
This uses the PDC Refresh indication to notify clients that
there is a new list of profiles.
2022-01-22 10:31:59 +01:00
Aleksander Morgado af0665c573 broadband-modem-mbim: implement support for GetCellInfo() 2022-01-18 09:00:10 +00:00
Aleksander Morgado 3c49e04377 iface-modem: implement support for 'GetCellInfo()' 2022-01-18 09:00:10 +00:00
Aleksander Morgado 322a601b29 broadband-modem-qmi: if UNSUPPORTED, ignore power update operation
We were returning success on this operation upon an UNSUPPORTED error,
and we should keep on doing the same after all the indication support
changes.
2022-01-14 10:36:39 +01:00
Aleksander Morgado 60f61e9740 broadband-modem-qmi: setup operation context for power up/down/off
We must keep a valid QmiClient reference for as long as the operation
runs, so that we can use it in all the request send operations we do,
and also so that we can remove the indication id upon completing the
operation.

The timeout id and indication id, which are also part of a single
power operation are also included in the operation context, because
they don't have any other meaning out of it.

The operation context is stored as task data.
2022-01-14 10:36:39 +01:00
Aleksander Morgado 1291754e60 broadband-modem-qmi: rework log and error messages 2022-01-14 10:36:39 +01:00