Commit Graph

51 Commits

Author SHA1 Message Date
Aleksander Morgado
064e92e9b7 api,simple: new 'multiplex' setting in bearer properties
Both the Simple.Connect() and Modem.CreateBearer() are updated to
allow a new 'multiplex' setting in the properties provided by the user
in both of these methods.

The new setting expects a MMBearerMultiplexSupport enum indicating
what kind of multiplex needs the user has:
 * none: if multiplex must not be used.
 * requested: if multiplex should be used if available.
 * required: if multiplex must be used.

The underlying implementations will take care of accepting or
rejecting the setting depending on the system and modem capabilities.
2021-03-10 10:59:19 +01:00
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
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
86a183778b api,sim: new 'Active' property
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...).
2020-08-28 14:59:06 +00:00
Aleksander Morgado
8722215f7e plugins: use logging module name as plugin name 2020-04-08 17:53:42 +02:00
Aleksander Morgado
2da417c7a2 iridium: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
40497a3904 iridium: fix warnings with -Wdiscarded-qualifiers
iridium/mm-plugin-iridium.c: In function ‘mm_plugin_create’:
  iridium/mm-plugin-iridium.c:64:52: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     64 |     static const mm_str_pair product_strings[] = {{"motorola", "satellite" },
        |                                                    ^~~~~~~~~~
  iridium/mm-plugin-iridium.c:64:64: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     64 |     static const mm_str_pair product_strings[] = {{"motorola", "satellite" },
        |                                                                ^~~~~~~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
5f3c415722 iridium: report selected RTS/CTS flow control to modem 2018-09-12 17:15:46 +00:00
Aleksander Morgado
74d8a69b4e iridium: simplify a bit the saved_error logic in connect
Note that saved_error will be freed along with the context, unless
it's set to NULL.
2017-10-07 10:55:16 +02:00
Ben Chan
3c2b974bbd iridium: port connect to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
d0bbc43fa7 iridium: port load_operator_{code,name} to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
2768df24b4 iridium: port setup_flow_control to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
aee8bcc748 iridium: port load_supported_modes to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
164ce73847 iridium: port create_bearer to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
254f2e3412 plugins: remove explicit GDestroyNotify cast on g_free / g_object_unref
g_free and g_object_unref are in form of  `void (*)(gpointer)`, which
matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
g_free and g_object_unref is thus not needed.
2017-03-29 10:22:18 +02:00
Aleksander Morgado
37bd614212 broadband-modem: implement default connection monitoring logic
A default implementation to monitor the ongoing connection is provided in the
generic MMBroadbandModem, based on AT+CGACT? to check whether the PDP context
of the connection (identified by the cached cid) is active or not.

This commit also disables the connection monitoring logic in those plugins that
have custom connection methods.
2016-10-12 11:29:52 +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
5358d6fea0 sim: rename 'MMSim' to 'MMBaseSim'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado
3ca267b01f bearer: rename 'MMBearer' to 'MMBaseBearer'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado
9cde02111b ports: rename 'MMSerialPort' to 'MMPortSerial' 2014-02-13 13:39:51 +01: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
9bef8531c1 iridium: use generic disconnection logic
The generic disconnection logic now already handles getting the port fully
closed and a wait time before reopening it, so no need for a custom
disconnection logic any more.
2013-02-20 16:07:02 +01:00
Aleksander Morgado
15d34d56fd bearer: new helper 'MMBearerConnectResult' type
Instead of returning 3 variables in connect_finish(), return a single reference
counted struct. This simplifies how the result is built and passed within a
GSimpleAsyncResult to each _finish() method.

This also simplifies the dialling step in the 3GPP connection sequence, as we
can use the same new type.
2013-02-18 15:41:26 +01:00
Aleksander Morgado
1746949277 ports: add port initialization sequences instead of iface-modem's modem_init()
Instead of a custom modem_init() step in the 'Modem' interface, just add a
sequence of port initialization commands in each port.

While enabling for the first time a non-hotplugged modem, we will issue the
port initialization commands only after having run the enabling_modem_init()
step (i.e. after ATZ usually).
2013-02-18 13:47:35 +01:00
Aleksander Morgado
30639606d3 broadband-modem: new step during 'enabling_started' to initialize the modem
We previously had the modem initialization command merged with some other port
setup commands in the 'modem_init' step of the 'Modem' interface. Instead of
doing this, we now split the logic into two separate steps:

A first 'enabling_modem_init' modem initialization step is to be run just after
the ports have been opened, but only during the first enabling operation, and
only if the modem was not hotplugged. A hotplugged modem is assumed to be
properly initialized already, so no need to ATZ-it. Also, we will now wait 500ms
by default after the modem initialization command has been sent, to let it
settle down.

The second 'modem_init' step will be run during the 'Modem' interface
initialization, and it currently only holds specific setup of the primary and
secondary serial ports. We'll be modifying this logic a bit in the next commits,
so no big deal to have that step name unchanged.
2013-02-18 13:47:34 +01: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
5d02361501 iridium: ignore initial power state loading
No need to initially power-up the modem.
2013-01-11 10:05:45 +01:00
Aleksander Morgado
7da2a65b43 plugins: fix generic GObject related macros 2012-12-27 08:48:11 +01:00
Aleksander Morgado
96305bb5c1 iridium: report only 'CS' mode supported
Iridium modems only support circuit-switched connections, so just report that
one as supported.
2012-11-02 09:48:56 +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
668976f4d7 iridium: ensure we skip power down during init 2012-10-01 16:40:52 +02:00
Aleksander Morgado
a66f971a7c libmm-common: added common utils from core
Moved the utils to play with binary to hex strings into libmm-common.
2012-09-14 07:05:26 +02:00
Aleksander Morgado
b42b5795e3 iface-modem-messaging: automatically detect the best default storage
Instead of letting the plugins specify a default storage to use, just look at
the supported ones and use the best one.

"MT is preferred over "ME" or "SM", as "MT=ME+SM"
2012-09-14 07:05:23 +02:00
Aleksander Morgado
bddcc2fb07 iface-modem-messaging: instead of mem1,mem2,mem3 use just a new default storage
There is no point in specifying a default 'mem1' memory storage, which is used
for reading/listing/deleting, as those are operations that need a specific
'mem1' set each time.

Also, there is no point in specifying separate default 'mem2' and 'mem3' memory
storages, specially because now we allow Sms.Store() to specify a storage.

So, we will now only have a 'default' memory storage, which is applicable for
both 'mem2' and 'mem3' (storing, sending from storage and deleting).
2012-09-14 07:05:23 +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
d18dbb869a base-modem-at: add 'raw' handling to `mm_base_modem_at_command_full()' 2012-08-24 12:32:29 +02:00
Aleksander Morgado
55699e6518 iridium: fix SIM object creation 2012-08-23 18:56:21 +02:00
Aleksander Morgado
39b497c3e7 iridium: plug memleak 2012-08-21 18:45: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
caeeae2721 bearer: simplify handling of the bearer configuration
The base MMBearer object will receive the MMBearerProperties configuration,
which contains every generic and plugin-specific set up. Not every configuration
parameter will be used by every implementation (e.g. not every bearer needs
user/password).

The Bearer object will expose every configuration parameter received in its
`Properties' property in the interface, even if it's not really used.
2012-05-06 17:12:36 +02:00
Aleksander Morgado
cdd339f802 base-modem: implement new modem-wide cancellable, and rework AT commands
Instead of the `_in_port()' variants, we'll provide more generic
`_full()' methods. These should be used either if we want to send commands
to a specific port, or if we want to use a specific user-provided GCancellable.

In addition to this user-provided GCancellable, we keep the internal modem-wide
one.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
cc6d4a97fb base-modem: new port getters and peekers
* mm_base_modem_peek_port_* () will return either a port object (no new
reference), or NULL if none available.

You would usually peek() a port if you're going to use it just in the current
method, as there is no way to that reference to get invalid (we're single
threaded).

 * mm_base_modem_get_port_* () will return either NEW references to valid
port objects, or NULL if none available.

And, you would usually get() a port, whenever you want the port object to be
valid even out of the current method, for example when keeping it in the
context of an async operation.

Also, we need to consider that the primary AT port MAY BE NULL when you
peek() or get() it. This is due to the fact that we may be releasing ports
(due to device disconnection) in the middle of async operations.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
d306bb082f libmm-common: `MMBearerProperties' won't be considered internal any more
Renamed `MMCommonBearerProperties' to `MMBearerProperties', and removed the
`MMBearerProperties' provided in libmm-glib. We'll just use the original one
from libmm-common always.
2012-03-16 14:53:19 +01:00
Aleksander Morgado
323df60ed9 libmm-common: `MMBearerIpConfig' won't be considered internal any more
Renamed `MMCommonBearerIpConfig' to `MMBearerIpConfig', and removed the
`MMBearerIpConfig' provided in libmm-glib. We'll just use the original one
from libmm-common always.
2012-03-16 14:53:19 +01:00
Aleksander Morgado
1701230f51 plugin-base: remove the SORT_LAST property
Plugins that need to get sorted last by the PluginManager can now be determined
just by looking at the post probing filters.
2012-03-16 14:53:18 +01:00
Aleksander Morgado
680e292914 build: fix header dependencies
We shouldn't depend on any header file from the previous implementation.
2012-03-16 14:28:15 +01:00