Commit Graph

55 Commits

Author SHA1 Message Date
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
d36df68226 wavecom: break loop matching 2G bands if exact combination found 2020-06-02 10:16:33 +02:00
Aleksander Morgado
a6607a5e7d wavecom: port to use g_autoptr() setup 2020-06-02 10:16:17 +02:00
Aleksander Morgado
08d40fe05d wavecom: fix GTask return handling when loading current caps 2020-06-02 10:01:43 +02:00
Aleksander Morgado
b71ae9ce72 wavecom: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  wavecom/mm-broadband-modem-wavecom.c: In function 'set_bands_3g':
  wavecom/mm-broadband-modem-wavecom.c:800:50: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array_final->data,
                                                    ^
  wavecom/mm-broadband-modem-wavecom.c: In function 'set_bands_2g':
  wavecom/mm-broadband-modem-wavecom.c:872:50: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array_final->data,
                                                    ^
2020-05-19 13:45:34 +02:00
Aleksander Morgado
8722215f7e plugins: use logging module name as plugin name 2020-04-08 17:53:42 +02:00
Aleksander Morgado
ab47b56573 wavecom: 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
Ben Chan
8d8b3a722a misc: use g_regex_match() for simplicity
This CL converts a few g_regex_match_full() expressions to their
equivalent g_regex_match() in order to simplify the code, i.e.

  g_regex_match_full (regex, str, strlen (str), 0, 0, &match_info, NULL)

is equivalent to:

  g_regex_match_full (regex, str, -1, 0, 0, &match_info, NULL)

or simply:

  g_regex_match (regex, str, 0, &match_info)
2019-07-10 14:48:22 -07:00
Ben Chan
7de6b6f2e1 core: remove unnecessary NULL checks for g_match_info_free()
g_match_info_free() already check if the given pointer is NULL and does
nothing on a NULL pointer.
2018-10-18 13:17:36 +02:00
Ben Chan
25f37fd613 wavecom: fix memory leak 2017-10-07 10:01:29 +02:00
Aleksander Morgado
833243570f wavecom: port modem_after_sim_unlock to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
288ebab106 wavecom: port register_in_network to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
ea3d20e98c wavecom: port set_current_bands to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
dd4ef7dc23 wavecom: port load_current_bands to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
e2b3b87674 wavecom: port load_supported_bands to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
bb5a950102 wavecom: port set_current_modes to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
fc33fe69b4 wavecom: port load_current_modes to use GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
02e16d42bc wavecom: port load_supported_modes to GTask 2017-09-07 19:28:23 +02:00
Aleksander Morgado
4c921cd584 wavecom: update frequency bands support
Updated to use the non-deprecated MMModemBand values.
2017-09-07 10:55:17 +02:00
Aleksander Morgado
a1210af7d5 wavecom: fix async operation completion 2017-08-29 07:45:34 +02:00
Aleksander Morgado
1d2a67ab20 wavecom: ignore custom flow control handling
The generic modem object already supports querying for the supported
methods and setting the best one found.
2017-04-18 18:08:57 +02:00
Aleksander Morgado
1f813c4e96 core: allow identifying devices by a user-provided 'uid'
All ports of the same modem reported by the kernel will all be associated with
a common 'uid' (unique id), which uniquely identifies the physical device. This
logic was already in place, what we do now is avoid calling it  the 'sysfs
path' of the physical device, because we may not want to use that to identify
a device.

This logic now also enables the possibility of "naming" the modems in a unique
way by setting the "ID_MM_PHYSDEV_UID" property in the "usb_device" that owns
all the ports.

E.g. a custom device has 4 modems in 4 different USB ports. The device path of
each USB device will always be the same, so the naming rules could go like this:

    $ vim /usr/lib/udev/rules.d/78-mm-naming.rules

    ACTION!="add|change|move", GOTO="mm_naming_rules_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
    LABEL="mm_naming_rules_end"

Each of the modems found will have a unique UID retrieved from the previous list
of rules. Then, "mmcli" has also been updated to allow using the UID instead of
the modem DBus path or index, e.g.:

    $ sudo mmcli -m USB-MODEM-1
    /org/freedesktop/ModemManager1/Modem/0 (device id '988d83252c0598f670c2d69d5f41e077204a92fd')
      -------------------------
      Hardware |   manufacturer: 'ZTE CORPORATION'
               |          model: 'MF637'
               |       revision: 'BD_W7P673A3F3V1.0.0B04'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: '356516027657837'
      -------------------------
      System   |         device: 'USB-MODEM-1'
               |        drivers: 'option'
               |         plugin: 'ZTE'
               |   primary port: 'ttyUSB5'
               |          ports: 'ttyUSB5 (at)'
    ...

    $ sudo mmcli -m USB-MODEM-1 --enable
    ...
2016-09-29 15:41:21 +02:00
Ting-Yuan Huang
969189d42c plugin-manager: protect mm_plugin_{major,minor}_version
This patch makes declarations bind to definitions within the same module
to prevent the potential ambiguity if referenced directly.

AddressSanitizer think they violated one definition rule, although
those symbols are accessed by address through their modules and do
not depend on the order of the libararies loaded.
2016-05-28 13:59:54 +02:00
Aleksander Morgado
ffde429843 core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncs 2015-12-02 17:07:39 +01:00
Aleksander Morgado
4eb733c07c wavecom: avoid +COPS=0 if already in automatic registration mode
AT+COPS=0 in a FXT009 may end up making the device stuck in a weird state
in which it only replies "+CME ERROR: 515" to every AT command. So try to
avoid this command whenever possible.
2014-03-07 12:30:36 +01:00
Aleksander Morgado
e3c4dec3d7 wavecom: implement power off
Powering off Wavecom devices is done via the AT^CPOF=1 command. These devices
seem to not only power-off, but also power-cycle when this command is received,
which means that the user needs to make sure to fully cut the power to the
device when the SetPowerState() method replies.
2014-02-20 11:18:22 +01:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado
e60485a4aa wavecom: implement after-sim-unlock step
Just give some time to the SIM to get properly initialized, so that we avoid
errors when reloading e.g. facility lock status.
2014-02-12 17:18:24 +01:00
Aleksander Morgado
1c67d050cb api,introspection: merge 'AllowedModes' and 'SupportedMode' into 'CurrentModes'
We now have a single 'CurrentModes' property which contains both values in a
tuple with signature "(uu)".

Also, rename 'SetAllowedModes()' to 'SetCurrentModes()', and update the list of
arguments expected to have a single "(uu)" tuple.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
45ceba7692 api,introspection: 'SupportedModes' is now a list of possible combinations
Instead of just a mask of MMModemMode values, we now provide a list of the
allowed and preferred mode combinations supported by the modem. E.g.:

$> sudo mmcli -m 0
  -------------------------
  Modes    |      supported: 'allowed: 2g; preferred: none
           |                  allowed: 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: 2g
           |                  allowed: 2g, 3g; preferred: 3g
           |                  allowed: 4g; preferred: none
           |                  allowed: 2g, 3g, 4g; preferred: none'
2013-06-05 19:15:14 +02:00
Aleksander Morgado
212d00c529 api,instrospection: rename 'Bands' to 'CurrentBands'
... and 'SetBands()' to 'SetCurrentBands()'.

We'll keep the 'Current' keyword in those properties which also have
'Supported' values.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
05ac6b6cf1 wavecom: don't grab ports handled by the qcserial driver
Sierra Wireless will assign the Wavecom USB vendor ID to some Gobi-based modems,
like the MC7750. Just ignore those by filtering out all devices with the Wavecom
USB vendor ID if they are handled by the qcserial driver.
2013-05-27 20:09:10 +02:00
Aleksander Morgado
eec5d00a97 core,plugins: remove initial power down sequence
We no longer power down the modem during initialization, so remove that
implementation.
2013-01-11 10:05:46 +01:00
Aleksander Morgado
e3db373be4 wavecom: no need to check if already powered up before powering up
This logic is now implemented by the parent broadband modem object.
2013-01-11 10:05:45 +01:00
Aleksander Morgado
c250fa3797 libmm-glib: remove the `libmm-common.h' header
Both the ModemManager daemon and the mmcli will now include `libmm-glib.h' only.

We also handle two new special `_LIBMM_INSIDE_MM' and `LIBMM_INSIDE_MMCLI'
symbols, which if included before the `libmm-glib.h' library allow us to:

 * Don't include the libmm-glib high level API in the ModemManager daemon, as
   the object names would clash with those in the core.

 * Define some of the methods of helper objects to be included only if compiling
   ModemManager daemon or the mmcli.
2012-10-04 10:17:12 +02:00
Aleksander Morgado
2ca70365cf wavecom: run power-down during init 2012-10-01 16:40:52 +02:00
Aleksander Morgado
567a744a49 wavecom: fix segfault when setting allowed modes 2012-08-28 17:15:18 +02:00
Aleksander Morgado
b087ba7d1d wavecom: fix loading supported bands 2012-08-28 17:15:18 +02:00
Aleksander Morgado
0436b3e457 api,introspection: report list of drivers, not just one
Different ports of the same modem may get handled by different drivers. We
therefore need to provide a list of drivers (new `Modem.Drivers' property with
signature 'as') instead of just one (removed `Modem.Driver' property with
signature 's').

$ sudo mmcli -m 0 | grep drivers
           |        drivers: 'qcserial, qmi_wwan'
2012-08-24 13:34:51 +02:00
Aleksander Morgado
1ca46cc0ec plugins: use default port grabbing on those plugins without special requirements 2012-08-06 20:06:46 +02:00
Aleksander Morgado
e5e46f489e core: merge MMPluginBase' and MMPlugin'
There's no real point in maintaining a separate `MMPlugin' interface, as all the
plugins will inherit from `MMPluginBase', so just merge them and simplify
everything.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
815693661c core: compile all ports before creating the modem object
Before this, we only exported the modem to DBus when all ports were organized,
in order to make sure that we select as primary port the one we really want and
not the first AT port grabbed. Given that to get all the ports organized we also
needed to wait to get all the ports grabbed, we can now also defer the creation
of the modem object until all the ports get grabbed. This allows us to create
different types of objects based on the ports available (e.g. we can now create
QMI-supported modem objects if we see a QMI port around).
2012-08-06 20:06:44 +02:00
Aleksander Morgado
6c26e90610 wavecom: implement custom band setting 2012-05-06 15:34:13 +02:00
Aleksander Morgado
8b329c1012 wavecom: setup custom serial parser
AT+CPIN? replies come without trailing 'OK'; which we need to handle.
2012-05-06 15:34:13 +02:00
Aleksander Morgado
43d7f4f17a wavecom: implement custom current bands loading 2012-05-06 15:34:13 +02:00
Aleksander Morgado
513f5d5f20 wavecom: implement custom supported bands loading 2012-05-06 15:34:13 +02:00
Aleksander Morgado
aeb38e0f30 wavecom: implement custom access technology loading 2012-05-06 15:34:13 +02:00
Aleksander Morgado
3885bb365d wavecom: implement setting allowed/preferred modes 2012-05-06 15:34:13 +02:00
Aleksander Morgado
1447dfee3c wavecom: implement loading of initial allowed/preferred modes 2012-05-06 15:34:13 +02:00