Commit Graph
3859 Commits
Author SHA1 Message Date
Aleksander Morgado b2f9771b85 broadband-modem-mbim: detect 5G support in custom data class
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/301
2021-02-15 00:43:15 +01:00
Aleksander Morgado f3f05f397a device: avoid trying to remove source multiple times
ModemManager[115879]: <debug> [1613341789.760031] [modem3] completely disposed

   (ModemManager:115879): GLib-CRITICAL **: 23:29:49.760: Source ID 2379 was not found when attempting to remove it

   Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
   0x00007ffff774b343 in g_logv () from /usr/lib/libglib-2.0.so.0
   (gdb)
   (gdb) bt
   #0  0x00007ffff774b343 in g_logv () at /usr/lib/libglib-2.0.so.0
   #1  0x00007ffff774b5c0 in g_log () at /usr/lib/libglib-2.0.so.0
   #2  0x00007ffff7741c9e in g_source_remove () at /usr/lib/libglib-2.0.so.0
   #3  0x00005555555aad02 in dispose (object=0x555555831260) at mm-device.c:802
   #4  0x00007ffff7843755 in g_object_unref () at /usr/lib/libgobject-2.0.so.0
   #5  0x00005555555a5107 in glib_autoptr_clear_MMDevice (_ptr=0x555555831260) at mm-device.h:63
   #6  0x00005555555a5125 in glib_autoptr_cleanup_MMDevice (_ptr=0x7fffffffe090) at mm-device.h:63
   #7  0x00005555555a59ab in device_removed (self=0x555555769220, subsystem=0x55555577dc50 "tty", name=0x555555869a40 "ttyUSB3") at mm-base-manager.c:237
   #8  0x00005555555a620d in handle_uevent (self=0x555555769220, action=0x5555558987b0 "remove", device=0x555555893840) at mm-base-manager.c:445
   #9  0x00007ffff7381acd in  () at /usr/lib/libffi.so.7
   #10 0x00007ffff738103a in  () at /usr/lib/libffi.so.7
   #11 0x00007ffff783c8fe in g_cclosure_marshal_generic () at /usr/lib/libgobject-2.0.so.0
   #12 0x00007ffff7837072 in g_closure_invoke () at /usr/lib/libgobject-2.0.so.0
   #13 0x00007ffff785fa85 in  () at /usr/lib/libgobject-2.0.so.0
   #14 0x00007ffff78535dd in g_signal_emit_valist () at /usr/lib/libgobject-2.0.so.0
   #15 0x00007ffff7853b40 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
   #16 0x00007ffff7e792aa in  () at /usr/lib/libgudev-1.0.so.0
   #17 0x00007ffff7742b84 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
   #18 0x00007ffff7796c21 in  () at /usr/lib/libglib-2.0.so.0
   #19 0x00007ffff77420d3 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
   #20 0x00005555555a1df4 in main (argc=2, argv=0x7fffffffea88) at main.c:213
2021-02-14 23:34:36 +01:00
Dylan Van Assche 7159b8e27a context: add test-no-suspend-resume cli parameter
Disables suspend/resume support at runtime.
This is useful for modems which are never turned off
or suspended when the host suspends.
2021-02-14 12:27:42 +00:00
Aleksander Morgado 6107774bb2 filter: add missing reference to rpmsg filter 2021-02-06 15:32:11 +01:00
Andrew Lassalle e732a9afcc broadband-modem-qmi: remove unused variables 2021-02-03 09:31:28 -08:00
Aleksander Morgado 268bf4f98a core: update copyright years to 2021 2021-01-17 10:33:45 +01:00
Aleksander Morgado d12ab8a25a iface-modem: avoid leaking the MmGdbusModem when bearers are updated
See See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/302
2021-01-11 14:27:46 +01:00
Andrew Lassalle 8ccd63ef64 test-sms-part-cdma: fix memory leak 2021-01-08 10:51:04 -08:00
Frederic Martinsons 2f53a08e5f iface-modem: don't consider charset setup failure as fatal.
On some modem (for example SORACOM SC-QGLC4-C1) , the character set setup
step fails with "Unknown error" when the SIM card is missing or locked.
This leads to not expose Modem interface and not being able to unlocked
the SIM.
We should not consider this step as fatal but just issue a warning to let
other steps continue (which will let modem in failed state anyway).

Closes #289

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-21 13:00:40 +00:00
Aleksander Morgado 3d4dd64dd0 broadband-modem-qmi: disable signal/access-tech polling if indications enabled
We can rely on QMI indications when the signal quality and access tech
changes happen, instead of doing explicit polling.

The modem will run the signal quality retrieval once, and then just
rely on indications, with polling disabled:

  ModemManager[278759]: <debug> [1606862198.230492] [modem1] signal strength (lte): -79 dBm
  ModemManager[278759]: <debug> [1606862198.230520] [modem1] signal strength: -79 dBm --> 55%
  ModemManager[278759]: <debug> [1606862198.230583] [modem1] access technology changed (unknown -> lte)
  ModemManager[278759]: <debug> [1606862198.230654] [modem1] signal quality updated (55)
  ModemManager[278759]: <debug> [1606862198.230675] [modem1] periodic signal quality and access technology checks not rescheduled: unneeded or unsupported
  ModemManager[278759]: <debug> [1606862198.230692] [modem1] periodic signal checks disabled

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/231
2020-12-21 12:05:57 +00:00
Aleksander Morgado 47f39c9e1a broadband-modem-qmi: fix disabling of signal strength events
Attempting to disable the signal strength events was failing because
the protocol handler expects a valid set of thresholds also during the
disabling. So, just pass always the thresholds.

  ModemManager[274522]: [/dev/cdc-wdm1] sent generic request (translated)...
  <<<<<< QMUX:
  <<<<<<   length  = 17
  <<<<<<   flags   = 0x00
  <<<<<<   service = "nas"
  <<<<<<   client  = 3
  <<<<<< QMI:
  <<<<<<   flags       = "none"
  <<<<<<   transaction = 7
  <<<<<<   tlv_length  = 5
  <<<<<<   message     = "Set Event Report" (0x0002)
  <<<<<< TLV:
  <<<<<<   type       = "Signal Strength Indicator" (0x10)
  <<<<<<   length     = 2
  <<<<<<   value      = 00:00
  <<<<<<   translated = [ report = 'no' thresholds = '{}' ]

  ModemManager[274522]: [/dev/cdc-wdm1] received generic response (translated)...
  <<<<<< QMUX:
  <<<<<<   length  = 19
  <<<<<<   flags   = 0x80
  <<<<<<   service = "nas"
  <<<<<<   client  = 3
  <<<<<< QMI:
  <<<<<<   flags       = "response"
  <<<<<<   transaction = 7
  <<<<<<   tlv_length  = 7
  <<<<<<   message     = "Set Event Report" (0x0002)
  <<<<<< TLV:
  <<<<<<   type       = "Result" (0x02)
  <<<<<<   length     = 4
  <<<<<<   value      = 01:00:08:00
  <<<<<<   translated = FAILURE: NoThresholdsProvided
2020-12-21 12:05:57 +00:00
Aleksander Morgado da15958799 broadband-modem-qmi: reload initial EPS bearer on data system updates 2020-12-21 12:05:57 +00:00
Aleksander Morgado 2d9b62d23b iface-modem-3gpp: allow requesting the reload of the initial EPS bearer 2020-12-21 12:05:57 +00:00
Aleksander Morgado 5629f47a59 libmm-glib,bearer-properties: allow loose comparisons
When comparing bearer properties provided by the user versus loaded
from the modem, we shouldn't be very strict, e.g.:
 * Password or other fields may not be readable from the device.
 * Some fields may not apply at all (e.g. RM protocol for EPS bearers)
 * NULL strings could be assumed equal to empty strings.
 * If no explicit IP type specified, an IPv4 default may be assumed.
 * If no explicit allowed auth specified, 'none' default may be
   assumed.

These loose comparisons are applied when managing the initial EPS
bearer settings and status, and we keep the strict comparison only
during the connection attempt lookup of a bearer with certain
settings, as those bearer objects are all created in the same place
with the same rules.
2020-12-21 12:05:57 +00:00
Aleksander Morgado c99cc9210e iface-modem-3gpp: log requested/updates initial EPS bearer settings 2020-12-21 12:05:57 +00:00
Aleksander Morgado 5613215db8 broadband-modem-qmi: implement initial EPS bearer settings loading and setting 2020-12-21 12:05:57 +00:00
Aleksander Morgado 527b4e3232 broadband-modem-qmi: implement initial EPS bearer info loading 2020-12-21 12:05:57 +00:00
Aleksander Morgado 295400688a broadband-modem-qmi: allocate a generic WDS client
For generic WDS operations not tied to any connection attempt.
2020-12-21 12:05:57 +00:00
Aleksander Morgado 0729ba5c88 broadband-modem-mbim: plug memleak when processing USSD in GSM7 2020-12-19 11:10:44 +01:00
Aleksander Morgado bee8a391bf broadband-modem-mbim: ignore MS SAR notifications explicitly
SAR service will be introduced in the stable libmbim 1.26.0, but it's
been flagged in the dev 1.25.1 version already.
2020-12-13 17:37:12 +01:00
Torsten Hilbrich 8072ed2d6f broadband-modem-mbim: Add MM_BROADBAND_MODEM_MBIM_QMI_UNSUPPORTED
This property (initially set to FALSE) controls whether QMI over MBIM
should never be considered. This property is set to TRUE for XMM-based
MBIM devices as they don't support QMI.

This fixes a probing delay of 15s on a Fibocom L850-GL device
(2cb7:0007) found in the Lenovo T14 Gen 1.

The establishing of a QMI connection was refused multiple time with
MBIM error OperationNotAllowed. Only the timeout of 15s for this
connection resumed the probing.

The properties in the MMBroadbandModemMbim are only installed when
WITH_QMI and QMI_MBIM_QMUX_SUPPORTED are set. Actually, this should only
disable the PROP_QMI_UNSUPPORTED but as this is the only property this
avoids the "unused variable 'self'" warnings/errors when trying to
compile set_property and get_property without QMI support. This can be
changed once other properties are needed.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/284
2020-12-03 08:00:30 +01:00
Aleksander Morgado f80c8d8be6 broadband-modem-qmi: fix reporting of signal strength indications
We had all the logic in place... but we were never actually enabling
the signal strength indications because the `enable` flag in the
context was never set.

The bug was introduced back in May 2018, and released with 1.10.0.

Fixes baefe53ab9
2020-12-01 22:08:41 +00:00
Dylan Van Assche d531992897 tests: added parse ERROR response test 2020-12-01 20:42:55 +00:00
Dylan Van Assche c15d103ca6 serial-parsers: also match ERROR responses that are not at end of line
Do not fail to detect an error response with a call or text incoming. This happens during port probing when there's no URC parsers installed in the serial port. This probably will not happen when the serial port was managed by the modem object.w
2020-12-01 20:42:55 +00:00
Dylan Van Assche c05580ca9a tests: added parse OK response test 2020-12-01 20:42:55 +00:00
Dylan Van Assche 750fb2bc4a serial-parsers: also match OK responses that are not at end of line
Do not fail to detect a valid response with a call or text incoming.
This happens also during port probing when there's no URC parsers
installed in the serial port. This probably will not happen when the
serial port was managed by the modem object.
2020-12-01 20:42:55 +00:00
Pavan Holla 1f0c04644d base-sim: Reprobe modem if puk lock is discovered after sending pin1
Enabling/Disabling/Changing/Sending the PIN1 lock is usually limited to
3 retries. If these attempts are exhausted, the modem is puk_locked.
We reprobe the modem to get rid of any unwanted interfaces and move
to a locked state.
2020-11-26 08:53:14 +00:00
Pavan Holla 38f6704fa1 base-sim: Reprobe modem if lock status cannot be read after sending puk
If the lock status cannot be read during a puk unblock attempt, reprobe
the modem. It is likely that the SIM was permanently blocked if the lock
status cannot be read.
2020-11-26 08:53:14 +00:00
Aleksander Morgado 6e0380c165 base-modem: order ports by name by default
When there are multiple ports with the same purpose (e.g. multiple net
data ports, or multiple QMI control ports), sort them by name by
default.

The port order does not make any difference for ports that have
flagged with a specific purpose (e.g. AT primary).

The sorting is done both in the internal lists and when looking up
ports with find_ports().
2020-11-20 09:24:51 +00:00
Aleksander Morgado cab4b54ad1 core: new 'rpmsg' subsystem
Most older Qualcomm SoCs (e.g. MSM8916, MSM8974, ...) communicate with
the integrated modem via shared memory (SMD channels). This is similar
to QRTR on newer SoCs, but without the "network" layer. In fact, the
older SoCs also have QRTR, but the modem QMI services are not exposed
there.

The mainline Linux kernel exposes SMD channels via the "remote processor
messaging bus" (rpmsg). Through special IOCTL calls it is possible to
create a char device for a rpmsg/SMD channel. We can then use these to
send QMI/AT messages to the modem, much like the ordinary serial char
devices when using a Qualcomm modem through USB.

This commit introduces support for the new 'rpmsg' subsystem, which
allows exporting QMI-capable and AT-capable ports.

By default NO rpmsg port is flagged as candidate, it is assumed that
the plugin adding support for the rpmsg subsystem will add specific
rules to do so (e.g. so that non-modem ports are explicitly not
flagged as candidate).

All rpmsg ports will be probed for AT or QMI capabilities, unless
explicit port type hints (e.g. ID_MM_PORT_TYPE_QMI or
ID_MM_PORT_TYPE_AT_PRIMARY) are set.

These changes are highly based on the initial integration work done by
Stephan Gerhold <stephan@gerhold.net> in postmarketOS, see:
  https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/363
2020-11-20 09:24:51 +00:00
Aleksander Morgado 3d12272d18 kerneldevice: allow loading port attributes
In addition to loading port and device properties, we now also allow
loading sysfs properties that are assumed to be static (i.e. their
values won't change since loaded the first time).
2020-11-20 09:24:51 +00:00
Aleksander Morgado 399a042dad bearer-qmi: support binding to data port
Allow plugins to specify a QmiSioPort value to bind to. This is used
e.g. in the RPMSG+BAM-DMUX setup in order to allow any RPMSG port to
control all the available net ports.
2020-11-20 09:24:51 +00:00
Aleksander Morgado 3be07bb38d tests,cdma: test CDMA SMS with different text lengths 2020-11-20 00:40:39 +01:00
David Leonard 7ac42e7648 sms: fix 7-bit ASCII SMS decoding
Fixes an issue where (5+8n)-character long SMS messages received on a
CDMA network would be dropped with a "cannot read user data" error,
while other length SMS messages would be delivered fine.

Fix thanks to Peter Hunt
2020-11-20 00:40:39 +01:00
Aleksander Morgado c3bc515b8a base-manager: never create kernel device objects for remove events
There is no point in creating a new kernel device object just to
process a remove event; instead, do any matching with existing
kernel device objects by subsystem and name, which is what the generic
backend already did anyway.

This avoids unnecessary lookup of information in sysfs during removal
events, because the port is anyway already gone when we try to look
those up.
2020-11-19 17:01:55 +00:00
Aleksander Morgado 047805348d iface-modem-firmware: allow plugins to ignore carrier info
Skip building the firmware version information with carrier config
information if the plugin already knows that the firmware upgrade
method doesn't implement carrier-specific upgrade paths.
2020-11-16 11:28:46 +01:00
Aleksander Morgado c7016f8933 iface-modem-firmware: report generic IDs for both USB and PCI devices
Instead of assuming that all modules supporting firmware upgrade are
USB based.
2020-11-16 11:28:46 +01:00
Andrew Lassalle 9533ee2f22 mm-plugin-manager: Fix typos
Change-Id: I662061384cf48abd0975e15a91b090aa6b33ac34
2020-11-15 06:49:42 -08:00
Aleksander Morgado e112896994 base-manager: allow forcing the testing without udev
Even if udev support is really built and available.

This is extremely useful to test the udev-less setup without fully
recompiling the whole daemon.

  E.g.: the daemon can be run like this:
    $ sudo /usr/sbin/ModemManager --debug --test-no-udev

  And then, the kernel events may be reported using mmcli like this:
    $ sudo mmcli --report-kernel-event-auto-scan
2020-11-14 22:55:52 +01:00
Aleksander Morgado 6e642418bb kerneldevice,generic: use regex to implement string matching
Instead of the custom simple implementation which only supported the
'*' modifier in the pattern. This allows us to support e.g. attribute
value matches like e.g. 'DATA[0-9]*_CNTL'.
2020-11-14 13:39:40 +00:00
Aleksander Morgado cca83392f0 kerneldevice,generic: implement ATTRS matching for any attribute
Until now we did not support ATTRS{} matches against attributes we
don't support in the core codebase. Implement now a simple lookup
mechanism which traverses the tree of sysfs path from the port sysfs
path to the physical device sysfs path, looking up the attribute
requested.

This is not completely equivalent to what udev does, because the udev
rules matching ATTRS would usually also include an additional previous
matching e.g. SUBSYSTEMS and such, so that the ATTRS is looked up
exactly in the device that also matches the additional previous
rules. In our case, we just simplify the logic and return the first
one found.
2020-11-14 13:39:40 +00:00
Aleksander Morgado 769ba3cee6 kerneldevice,generic: fix DRIVERS and SUBSYSTEMS checks
We were applying the DRIVERS check looking only at the single port
driver. Instead, we now lookup and cache all drivers found in the
device tree, and apply the loose DRIVERS check properly looking at all
of them.

We were applying the SUBSYSTEMS and SUBSYSTEM check looking at the
sysfs path and just hoping the subsystem we're looking for is included
in the path itself. Instead, we now lookup and cache all susystems
found in the device tree, and apply the loose SUBSYSTEMS check
properly looking at all of them.

E.g. we can now match SUBSYSTEMS="mhi_q" in the following device tree,
without needing it to be found in the sysfs path:

  looking at device '/devices/pci0000:00/0000:00:1b.0/0000:01:00.0/1001_00.01.00_MBIM/mhi_uci_q/mhi_MBIM':
    SUBSYSTEM=="mhi_uci_q"
  looking at parent device '/devices/pci0000:00/0000:00:1b.0/0000:01:00.0/1001_00.01.00_MBIM':
    SUBSYSTEMS=="mhi_q"
  looking at parent device '/devices/pci0000:00/0000:00:1b.0/0000:01:00.0':
    SUBSYSTEMS=="pci"
2020-11-14 13:39:40 +00:00
Aleksander Morgado ba361f41c4 kerneldevice,generic: support PCI device common attribute names
The vendor and product IDs stored for the MMKernelDevice object in the
PCI subsystem are mapped to the "vendor" and "device" attributes.
2020-11-14 13:39:40 +00:00
Aleksander Morgado d3a7f70135 kerneldevice,generic: preload port info based on the system bus
The generic backend implementation was really based on detecting USB
devices, not so much devices in other subsystems. This patch puts the
generic backend at the same level as the udev backend to support
non-USB modems.
2020-11-14 13:39:40 +00:00
Aleksander Morgado bc895067ec kerneldevice,udev: preload port info based on the system bus
USB, PCI, PCMCIA... all these different system buses expose modems in
different ways. Instead of having single methods to attempt to load
different things for all these device types, detect first which is the
system bus in use, and then perform a bus-specific operation to
preload the different things.
2020-11-14 13:39:40 +00:00
Aleksander Morgado 4550dcfbdf kerneldevice: no need to subclass the type getters
We can just subclass the methods to check whether a given property
exists and to get it as a string, and then implement in the generic
class the actual boolean/int/hex type getters common for all.
2020-11-14 13:39:40 +00:00
Aleksander Morgado 1e1fe8fb9c kerneldevice: remove all unneeded g_return_if_fail() checks
These kind of checks are only useful on public APIs really, there
should be no need to have them in internal code.
2020-11-14 13:39:40 +00: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 da77dc7152 plugin: build probing needs based on subsystem
Don't rely on the QMI or MBIM ports named cdc-wdm, use the device
subsystem instead.
2020-11-13 08:57:06 +00:00
Aleksander Morgado 71f5c97543 base-manager: automatic required subsystem detection
Instead of assuming we require a fixed set of subsystems to monitor,
compile the full list based on what the plugins have requested
themselves.
2020-11-13 08:57:06 +00:00