Commit Graph

7059 Commits

Author SHA1 Message Date
Aleksander Morgado
4ec2db75b8 port-serial-qcdm: allow specifying input subsystem
We have assumed until now that all QCDM ports are based on TTY
drivers, e.g. exposed via USB.

This may no longer be true, so allow creating QCDM ports with
an explicit subsystem instead of defaulting always to TTY.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
56fca14473 base-modem: refactor port grabbing logic
Split in its own method the per-subsystem port creation mechanism, and
apply all common AT port settings (e.g. response parser, flags) in a
single place.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
2a6b596bcf port-serial-at: skip validating input subsystem argument
This check is pointless given that we're not implementing API, if
anything it should be an assert. Anyway, just get rid of it, so that
we don't need to update it on every new subsystem we add as supported.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
f052e914c8 port: rename subsystem from 'usb' to 'usbmisc'
Back in Linux < 3.6 days, the cdc-wdm ports exposed by the QMI driver
were flagged as owned by the 'usb' subsystem. That changed in 3.6 when
the subsystem was renamed to 'usbmisc':

  https://mail.gnome.org/archives/networkmanager-list/2012-June/msg00125.html

So, rename the port subsystem type enumn to 'usbmisc'.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
c92dc21a18 api: new ID_MM_PORT_TYPE_QMI and ID_MM_PORT_TYPE_MBIM udev hints
It is no longer true that all QMI ports are exposed by the qmi_wwan
driver and that all MBIM ports are exposed by the cdc_mbim driver.
There are other generic setups that allow exposing these types of
ports using different drivers, and usually we can also know the type
of port in advance via other means. Therefore, allow adding udev port
type hints for QMI and MBIM ports as well.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
e01c8b379c broadband-modem-qmi: peek QMI port from any subsystem
No longer has to be bound to the USB subsystem.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
b8cbc87249 broadband-modem-qmi: allow subclassing the match of control vs net ports
By default we provide the implementation for the qmi_wwan driver,
where both control and net ports share the same USB interface.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
b8f6fb59ed broadband-modem-qmi: peeking QMI port only in QMI modems
Move the logic out of the base modem, and make it applicable only for
QMI modems.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
0dbb8d03f5 broadband-modem-mbim: peek MBIM port from any subsystem
No longer has to be bound to the USB subsystem.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
85d549ef00 broadband-modem-mbim: allow subclassing the match of control vs net ports
By default we provide the implementation for the cdc_mbim driver,
where both control and net ports share the same USB interface.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
6defec2fae broadband-modem-mbim: peeking MBIM port only in MBIM modems
Move the logic out of the base modem, and make it applicable only for
MBIM modems.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
ca0dbd0728 plugin: network interface force ignore rules for certain drivers only
The rules to force ignoring certain network ports because the modem is
using some specific drivers should definitely only be applied for the
very known qmi_wwan and cdc_mbim drivers.

If network ports for QMI or MBIM modems are exposed using different
network drivers, don't ignore them.
2020-11-09 18:41:57 +01:00
Aleksander Morgado
5aa7632e88 port-probe: avoid subsystem based checks when reading probe results
There should be no need to do an early check to filter out ports of
the wrong subsystem.

For the user of these methods it is irrelevant if the FALSE is
returned because the port is of the wrong subsystem, or because the
test wasn't added to be probed, or because the test actually failed.

In other words, the ports where the test succeeded will only have
succeeded if they are of the correct subsystem and if the test was
actually executed successfully.
2020-11-09 17:58:40 +01:00
Aleksander Morgado
50c69d5403 build: fix distcheck with new gtk-doc
The .actions file is generated by newer gtk-doc releases, we just
treat it as e.g. the .signals or .types files.

This is also already fixed in upstream gtk-doc:
  https://gitlab.gnome.org/GNOME/gtk-doc/-/merge_requests/61
2020-11-08 10:09:32 +01:00
Aleksander Morgado
f874b0f6b7 build: update builtin gtk-doc support
From gtkdocize (gtk-doc) 1.33.0.
2020-11-08 10:09:32 +01:00
Aleksander Morgado
904adbfb5e build: do not require xsltproc when building from a release tarball
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/276
2020-11-08 10:09:32 +01:00
Aleksander Morgado
3bda0562b9 build: don't remove ModemManager-names.h on 'clean'
The ModemManager-names.h header file is generated on git builds, and
shipped within the release tarball, so treat it as a maintainer
managed file that should only be removed on 'maintainer-clean'.

This allows us to avoid requiring xsltproc to build release tarballs.
2020-11-08 10:09:32 +01:00
Aleksander Morgado
5df9ddac18 filter: simplify CDC_WDM rule to a subsystem-only USBMISC check
This is not just a rename of the rule, we also now avoid doing an
explicit check on the port name as well, and we rely on subsystem
checks only; i.e. the same logic applied for net ports.

The port candidate rules already do a 'cdc-wdm*' device name check
so it shouldn't be a big deal.
2020-11-06 12:37:10 +01:00
Aleksander Morgado
5265c0bd7c modem-helpers-qmi: don't check result when parsing UIM Get Card Status Output
Do it earlier, before running the parser.
2020-11-06 11:45:02 +01:00
Andrew Lassalle
d7288861a5 mm-kernel-device: Fix cmp to exclude subtypes
If multiple kernel device types inherit from MMKernerDevice, and those
are compared against each other, the current logic returns TRUE if the
G_OBJECT_TYPE of one of them is smaller than the other. This function is
checking for equality, so returning FALSE is enough.
2020-11-05 09:07:55 +00:00
Aleksander Morgado
30f0824ea1 huawei: apply GETPORTMODE hints to serial ports in order
The numbers associated to each port mode given by the AT^GETPORTMODE
response are not USB interface numbers, they are 'port numbers'.
Moreover, these numbers may start either at 0 or at 1, depending on
the firmware.

The only reasonable way to parse this response is to just gather the
order of all the port modes reported, and apply the modes to each
serial port found in the system in the same order.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/239
2020-11-04 11:15:19 +00:00
Aleksander Morgado
4fdf28bb56 huawei: new ^GETPORTMODE response parser 2020-11-04 11:15:19 +00:00
Aleksander Morgado
b2621b4336 huawei: plugin already processes generic tags
So don't re-process them in the generic modem when grabbing the port.
2020-11-04 11:15:18 +00:00
Aleksander Morgado
824ad11356 huawei: don't apply multiple port type hints methods
We will use one single method to apply port type hints, not a mix of
them:
  * If AT^GETPORTMODE is supported, prefer its hints over any other
    method.
  * Otherwise, try to guess hints from USB interface descriptions.
  * And if none of the plugin-specific hints are supported, we'll
    default to applying generic port type hints from udev tags.

Once the hints have been applied by one of the methods above, the
fallback hint sequences are run:
  * Flag the first cdc-wdm port as primary if no other port has been
    flagged as primary.
  * Flag the USB interface 0 as PPP if no other port type hint has
    been set in any other port.

The logic applying all these procedures has been refactored so that we
have separate functions for each, which is much easier to read and
follow, even if it requires multiple iterations over the port probe
list.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/238
2020-11-04 11:15:18 +00:00
Aleksander Morgado
f21fde3855 cinterion: fix port reference leaks
The mm_base_modem_get_port_*() returns a full reference, we should use
the mm_base_modem_peek_port_*() methods instead. Also, refactor a bit
the logic because both ports are really configured in the same way, so
just apply the same setup to both.
2020-11-04 09:51:14 +01:00
Aleksander Morgado
2d28969df7 cinterion: source reorder
The class object definition should always be last in the file,
following the interface definitions. The actual method implementations
should be given before any other type system method (i.e. before even
the _new() method).
2020-11-04 09:51:14 +01:00
Aleksander Morgado
35ecd45b66 cinterion: load initial EPS bearer cid only once
There is no need to reload it on every settings update attempt; just
load it once when the 3GPP interface is initialized, and re-use the
loaded value on every new update attempt.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
eb6ec1913f cinterion: fallback to RF on on error right away
Don't go to next step and then check if we need to jump to the RF on
step, jump right away.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
7e70911074 cinterion: failure to set low power in initial EPS setting is fatal
Attempting to change the initial EPS bearer settings while in full
functionality mode shouldn't happen, so make sure we don't attempt to
do that if going into low power mode fails.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
f280573f6d cinterion: setup SGAUTH response parser as a helper method 2020-11-04 09:50:13 +01:00
Aleksander Morgado
eb338c967f cinterion: move auth helpers to the helpers sources 2020-11-04 09:50:13 +01:00
Aleksander Morgado
9ce496613b cinterion: improve logging when loading initial EPS status or settings 2020-11-04 09:50:13 +01:00
Aleksander Morgado
411cce677d cinterion: refactor the initial EPS related logic
Multiple changes that shouldn't affect behavior:

 * Avoid reusing the same context and state machine for the set and
   the load operations, because they truly have different behaviors.

 * Setup the common load operation in a separate async method, and
   reuse the common operation for both the runtime state loading and
   the settings configuration loading.

 * Avoid having a "generic step ready" method, and instead provide
   proper ready methods for each step, so that we can give
   comprehensive warning logs when things fail.

 * Use the common CFUN? response parser instead of a custom
   implementation.
2020-11-04 09:50:13 +01:00
Andrew Lassalle
ff7c0794f4 mm-broadband-modem: Allow hot SIM insertion
If the QMI modem is initialized without a SIM card in it, and it goes
to failed state, allow the modem to be reprobed when a SIM card is
inserted.
2020-10-30 12:44:20 -07:00
Aleksander Morgado
c385031941 base-modem: sort port info array by port name
So that the list of ports shown in the Ports DBus property is also
alphabetically sorted by port name, instead of having a mess like
this:

  -----------------------------
  System   |            device: qcom-soc
           |           drivers: bam-dmux
           |            plugin: qcom-soc
           |      primary port: rpmsg0
           |             ports: rmnet5 (net), rmnet_usb0 (unknown), rmnet4 (net),
           |                    rpmsg1 (at), rmnet3 (net), rpmsg0 (qmi), rmnet2 (net), rmnet1 (net),
           |                    rmnet7 (net), rmnet0 (net), rmnet6 (net)
2020-10-30 09:30:46 +01:00
Stephan Gerhold
a174edb74d api: expose ignored ports as MM_MODEM_PORT_TYPE_IGNORED
At the moment, ignored ports show up as (unknown) in the ports list
in mmcli. This makes it look like something went wrong while probing.

Actually ModemManager already tracks unknown and ignored ports separately
(MM_PORT_TYPE_UNKNOWN vs MM_PORT_TYPE_IGNORED) but the API always exposes
them as MM_MODEM_PORT_TYPE_UNKNOWN.

Add MM_MODEM_PORT_TYPE_IGNORED and use this for ignored ports so they
show up as (ignored) instead in mmcli.
2020-10-30 09:26:24 +01:00
Aleksander Morgado
fb14d0dbb2 helpers-qmi: 'illegal' card application state is fatal
No need to retry checking card status when the application state is
illegal, just treat the SIM card as unusable right away.

  https://forum.sierrawireless.com/t/uim-card-application-state-illegal/21842
2020-10-29 23:04:42 +00:00
Aleksander Morgado
9c1843c381 shared-qmi: ignore NoEffect errors on slot switching
When "UIM Switch Slot" returns a NoEffect error it's because we're
already in the desired slot, so just treat it as a successful
operation.
2020-10-29 22:52:06 +01:00
Aleksander Morgado
a31d762250 log: ignore fatal flag for logging purposes
Running with G_DEBUG=fatal-warnings will end up reporting warning logs
with G_LOG_FLAG_FATAL, which breaks our own logging logic.
2020-10-25 21:38:01 +01:00
Aleksander Morgado
ba1d3f944b libmm-glib,docs: add missing reference to mm_gdbus_sim_set_eid()
It's a private method, so add it in the Private subsection.
2020-10-25 21:37:47 +01:00
Aleksander Morgado
7d6647968d broadband-modem-qmi: minor coding style fix 2020-10-21 12:32:24 +02:00
Aleksander Morgado
8a54baa346 broadband-modem-qmi: fix crash when device removed during init
If the modem goes away (ports removed) during the initialization
phase (e.g. while QMI clients are being allocated), the MMPortQmi
object will be closed and it will lose its internal QmiDevice.

We should therefore consider the lack of QmiDevice a valid usecase in
track_qmi_device_removed() and return a GError when that happens.

    #0  0x00007fb544618cc9 in raise () from /lib/libc.so.6
    #1  0x00007fb54461bd68 in abort () from /lib/libc.so.6
    #2  0x00007fb544e2213d in g_assertion_message () from /usr/lib/libglib-2.0.so.0
    #3  0x00007fb544e221ba in g_assertion_message_expr () from /usr/lib/libglib-2.0.so.0
    #4  0x00000000004be584 in track_qmi_device_removed ()
    #5  0x00000000004be5e3 in allocate_next_client ()
    #6  0x00000000004be7b1 in qmi_port_allocate_client_ready ()
    #7  0x00007fb5453690a3 in g_task_return_now () from /usr/lib/libgio-2.0.so.0
    #8  0x00007fb54536967e in g_task_return () from /usr/lib/libgio-2.0.so.0
    #9  0x00000000004dd8f8 in allocate_client_ready ()
    #10 0x00007fb5453690a3 in g_task_return_now () from /usr/lib/libgio-2.0.so.0
    #11 0x00007fb54536967e in g_task_return () from /usr/lib/libgio-2.0.so.0
    #12 0x00007fb54591d4de in allocate_cid_ready () from /usr/lib/libqmi-glib.so.5
    ...
2020-10-19 21:14:23 +00:00
Eric Caruso
61739ab934 libmm-glib,mmcli: add mm_sim_get_eid and add EID to mmcli output
This exposes the new EID property of the SIM object on mmcli.
2020-10-19 20:38:43 +00:00
Eric Caruso
e24a8240cb mm-shared-qmi: load EID during SIM slot loading
SIMs can be created with an EID fetched during load_sim_slots
while initializing the modem, if present.

Since load_eid would be implemented with the same mechanism
we avoid using it here (if Get Slot Status fails once, it
probably doesn't make a lot of sense to try it again).
2020-10-19 20:38:43 +00:00
Eric Caruso
9fca046780 mm-base-sim: add EID D-Bus property
This provides a new D-Bus property on the Sim object that
exposes the EID of the SIM, if available.
2020-10-19 20:38:43 +00:00
Aleksander Morgado
1ed9f7e94e broadband-modem-qmi: minor coding style fixes 2020-10-19 22:34:35 +02:00
Eric Caruso
1800983b6c mm-modem-helpers: add low_nybble_first argument to mm_bcd_to_string
All BCD-encoded strings used by MM currently have the low nybble
of each byte come before the high nybble, but some strings (such
as the EID string returned by QMI Get Slot Status) are meant to
be read in order with the high nybble before the low one. As such,
extend mm_bcd_to_string to decode both.
2020-10-16 11:22:37 -07:00
Aleksander Morgado
f013e94ff8 xmm: fix missing GError initialization 2020-10-14 14:41:19 +02:00
Aleksander Morgado
3b6176cbe2 simtech: fix missing GError initialization 2020-10-14 14:41:19 +02:00
Aleksander Morgado
50c1550c9f cinterion: fix missing GError initialization 2020-10-14 14:41:19 +02:00