Commit Graph

44 Commits

Author SHA1 Message Date
Aleksander Morgado
0e6660025e libmm-glib,common: add helpers to build printable strings 2022-11-04 13:12:56 +00:00
Aleksander Morgado
bfba265009 libmm-glib,common-helpers: don't assume new_from_unix_utc() always succeeds
The g_date_time_new_from_unix_utc() method in glib2 may fail if the
given timestamp is too far into the future. The value is supposed to
be seconds since unix time origin, but internally it will be converted
into usecs, so any value longer than G_MAXINT64 / USEC_PER_SECOND
isn't allowed.

This is currently used in the CLI, and we're anyway ignoring the error
returned in that case, but at least it won't crash if it ever happens.
2022-10-05 09:06:22 +00:00
Carlo Lobrano
ac243f9467 sms: prevent crash if date is out of range
g_date_time_new, and g_date_time_new_utc return NULL if inputs are out
of range, and currently mm_new_iso8601_time passes the GDateTime created
by those two functions to date_time_format_iso8601 without checking for
NULL values, causing a g_date_time_format_iso8601 crash if PDU data is
corrupted with wrong date.

To prevent this, mm_new_iso8601_time now can return NULL and set a new
GError if GDateTime created by g_date_time_new is NULL.

Fixes #546
2022-04-08 15:41:49 +02:00
Aleksander Morgado
50fc0101f5 libmm-glib: new 'profile-source' in 3GPP profile
Not applicable to bearer properties, as this is exclusively a proflie
management setting, unrelated to connection attempts.
2021-12-24 14:03:15 +01:00
Aleksander Morgado
e61fd7ca58 libmm-glib: new 'access-type-preference' in 3GPP profile and bearer properties 2021-12-24 14:03:13 +01:00
Aleksander Morgado
22657021fb libmm-glib: new helper to handle the 5GNR registration settings 2021-12-24 12:41:27 +00:00
Aleksander Morgado
21c775703c libmm-glib: fix license in sources
The libmm-glib library is LGPLv2+, not GPLv2+.
2021-11-16 17:54:26 +01:00
Aleksander Morgado
3ab765f11c api,3gpp: new 'SetPacketServiceState()' method 2021-11-02 09:50:17 +00:00
Frederic Martinsons
9d82d30978 cli, plugins: factorize usage of iso8601 datetime format
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

Includes updates by Aleksander Morgado to fix coding style issues.
2021-10-22 13:48:20 +02:00
Frederic Martinsons
0510e9aef8 api,bearer: new 'start-date' field in bearer statistics
It stores the epoch timestamp of the current bearer session start.
If there is no connected bearer, it is set to 0 and not displayed
in mmcli output.

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

Includes updates by Aleksander Morgado to fix coding style issues.
2021-10-22 13:48:13 +02:00
Aleksander Morgado
d7acc276e5 libmm-glib,modem: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
30c9fc65da libmm-glib,common-helpers: refactor helper methods
Remove unused methods, like all the variant_to_array() ones, and
reorder some others so that both header and source file have the same
order always.
2021-07-01 15:18:44 +02:00
Aleksander Morgado
de6b1324cb api,bearer: new 'ConnectionError' property
This new property will provide detailed information about the failed
connection attempt, or about the network initiated disconnection. The
property will be cleared only if a new connection attempt is
triggered, and so it can be used to investigate why a given attempt
failed without needing to be the one who triggered the attempt (e.g.
so that failures in NetworkManager-triggered connection attempts can
be investigated looking at the DBus API).

The property is built as a (ss) tuple, but the libmm-glib interface
provides methods to read this property as a GError.
2021-05-23 01:22:07 +02:00
Aleksander Morgado
ff45d292ee libmm-glib: setup common helper to register DBus errors 2021-05-22 22:58:37 +00:00
Michal Mazur
b1dde0aec3 libmm-glib: add helper to get 3gpp facility from string 2021-04-30 18:40:29 +00:00
Aleksander Morgado
ff8e21b535 api,bearer: new 'apn-type' setting
This new setting allows the user setting up the connection to specify
the purpose of the connection being brought up.

Until now, we would always assume that connections are exclusively
brought up for connecting to the Internet, also limited by the
inability to connect to multiple different APNs at the same time.

But that may really not be true as there may be additional services
that may be accessed through other APNs, like MMS services or even
private networks for companies that have their own APNs on a given
operator (e.g. not that uncommon with banks and connected cars).

The new APN type setting will not change the way the bearer is
connected, but will allow the connection manager to decide what kind
of networking setup the specific connection needs.

This new setting can be provided by the user itself, or implicitly
read from the device if the device stores this information.
2021-04-29 10:13:22 +00:00
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
Teijo Kinnunen
0919abaa2f mmcli,sim: implement --sim-set-preferred-networks function 2021-03-09 08:52:55 +02:00
Aleksander Morgado
34de613dea libmm-glib,common-helpers: make hexstr2bin() return a guint8 array
It makes much more sense than returning a gchar array, as gchar is
signed.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
a211981d4a libmm-glib,common-helpers: make hexstr2bin() accept input string length
Optionally given explicitly, and -1 can be used to assume it's
NUL-terminated.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
657cabcfce libmm-glib,common-helpers: make hexstr2bin() return a GError
This util method checks whether the input string is a valid hex
string, so make sure we return a GError on failure.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
1c7304eb71 libmm-glib,helpers: allow reading hex strings from match info 2020-04-09 12:38:50 +00:00
Aleksander Morgado
6de1363174 api,modem: improve capabilities related documentation
And remove the unused mm_common_build_capability_combinations_any()
method in the common non-public library code.
2020-04-09 06:46:02 +02:00
Aleksander Morgado
ddb7d915a7 libmm-glib: unconditionally define autoptr support for all types
As we now depend on glib 2.48
2020-01-15 18:56:21 +01:00
Aleksander Morgado
be4fa661c1 plugins,telit: refactor #BND command support
And added support for several new things, including:
 * Setting "any" band now attempts to set all supported bands.
 * Added new 2G band value '5' (egsm+dcs+pcs+g850).
 * Setup support for two different 3G band combinations, a default one
   plus an alternate one applicable to the LM940/960 models only. The
   alternate combination is selected via udev tags.

During the refactor, the following Telit-specific helpers were also
removed and exchanged with more generic counterparts.
 * mm_telit_bands_contains() -> mm_common_bands_garray_lookup()
 * mm_telit_get_band_flags_from_string() -> mm_parse_uint_list()
2019-09-17 10:52:42 +02:00
Aleksander Morgado
7330f6d581 libmm-glib,common: new helper methods to read guint64 values
We use strtoull() to read a "unsigned long long" that is always at
least 64bits, even in 32bit systems.
2019-03-29 10:07:29 +00:00
Dan Williams
397faef3c5 mm-common-helpers: add mm_autoptr helpers for GRegex and GMatchInfo
Alias them to g_autoptr() on glib >= 2.44, otherwise re-implement.
2018-12-04 17:39:15 +00:00
Aleksander Morgado
2e0471fe6a libmm-glib: new common helpers to check band types 2018-08-21 17:02:39 +00:00
Aleksander Morgado
d4aaa436d9 modem-3gpp: allow loading and changing EPS UE mode of operation
The UE modes of operation for LTE are defined in 3GPP TS 24.301 (e.g.
section 4.3 in v10.3.0):
  * PS mode 1: EPS only, 'voice centric'
  * PS mode 2: EPS only, 'data centric'
  * CS/PS mode 1: EPS and non-EPS, 'voice centric'
  * CS/PS mode 2: EPS and non-EPS, 'data centric'

The mode specifies, among other things, how the UE should behave w.r.t
CS fallback depending on the capabilities reported by the network.
2018-01-20 15:41:07 +01:00
Aleksander Morgado
292914cf65 iface-modem: always sort supported and current bands before exposing them 2016-10-12 13:24:09 +02:00
Aleksander Morgado
58c955f5f2 core: allow building and running without udev
Instead of relying on the udev daemon and GUDev to manage the devices reported
by the kernel, we can now run ModemManager relying solely on the kernel events
reported via the new ReportKernelEvent() API. Therefore, the '--no-auto-scan'
option is implicit for the ModemManager daemon when udev is disabled in the
build.

Additionally, a new custom implementation of the kernel device object is
provided, which uses sysfs to load the properties and attributes required in
each kernel device, instead of using a GUdevDevice.

The udev rule files are kept in place, and a simple custom parser is provided
which preloads all rules in memory once and then applies them to the different
kernel objects reported via ReportKernelEvent(), e.g. to set port type hints.
A simple unit test setup is prepared to validate the udev rules during the
`check' Makefile target.
2016-09-29 15:43:05 +02:00
Riccardo Vangelisti
0bf4ad6b66 libmm-glib: added support for Modem.Voice and Call interfaces 2015-08-02 10:39:12 +02:00
Aleksander Morgado
86795b928e libmm-glib: allow new 'teleservice-id' and 'service-category' keywords in MMSmsProperties 2013-10-25 19:49:54 +02:00
Aleksander Morgado
7751f2d6ed mmcli,oma: support for the new OMA interface 2013-09-09 10:20:40 +02:00
Aleksander Morgado
8ab38ae968 libmm-glib: support for the 'OMA' interface 2013-09-09 10:15:18 +02:00
Aleksander Morgado
3206e95663 api,introspection: new 'Ports' property in the Modem interface
We will expose a new 'Ports' property listing all ports currently known by a
given modem. Ports which are not used but are detected as being part of the
modem will be listed with an 'unknown' port type.

This change uses the new 'MMModemPortType' enum and the new 'MMModemPortInfo'
helper struct to handle these values in libmm-glib. The already available
'MMPortType' enum hasn't been re-used for the interface because it contains
values that we don't need (e.g. IGNORED).

The port list is now also included in the modem information command of mmcli:

$ sudo mmcli -m 0

/org/freedesktop/ModemManager1/Modem/0 (device id '97b7b99e3e2bea103880545b619fb05a3cc81b26')
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4'
           |        drivers: 'qcserial, qmi_wwan'
           |         plugin: 'Gobi'
           |   primary port: 'cdc-wdm0'
           |          ports: 'ttyUSB0 (qcdm), ttyUSB1 (at), cdc-wdm0 (qmi), wwp0s29u1u4 (net)'

https://bugzilla.gnome.org/show_bug.cgi?id=702678
2013-06-24 19:44:57 +02:00
Aleksander Morgado
0db920b762 mmcli: new '--set-current-capabilities' command
New command to allow changing modem capabilities, if supported. The modem will
power cycle automatically after having changed them.
2013-06-05 19:15:15 +02:00
Aleksander Morgado
700ebc5c07 api,introspection: rename 'ModemCapabilities' to 'SupportedCapabilities'
And also make it a list of masks, specifying which are the specific combinations
supported, not just one mask with all.

E.g.:
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7710'
           |       revision: 'SWI9200X_03.05.19.04ap r5475 carmd-en-10527 2012/09/17 17:57:14'
           |      supported: 'gsm-umts
           |                  gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '358178040668164'
2013-06-05 19:15:15 +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
b1bb8e30b4 broadband-modem: don't assume the returned string is always hex-encoded 2013-02-22 19:43:49 +01:00
Aleksander Morgado
ebd792d2aa api,libmm-glib: new `allowed-auth' configuration for bearers
For bearers using STATIC or DHCP IP method, the modem itself is the one
negotiating authentication with the network. The new `allowed-auth' property
allows users to specify which authentication method(s) are allowed to be used.

See the following NetworkManager commit for more reference:
    commit 34aef8aaaa09b7473b9496aa49e550bd2def03f8
    Author: Andrew Bird <ajb@spheresystems.co.uk>
    Date:   Thu Mar 15 16:19:43 2012 -0500
2012-10-07 21:12:00 +02:00
Aleksander Morgado
4251030bd8 api: only allow including `ModemManager.h' directly 2012-10-04 10:17:13 +02:00
Aleksander Morgado
433fdea6d4 libmm-glib: only allow including `libmm-glib.h' directly
Unless when compiling libmm-glib itself, of course.
2012-10-04 10:17:12 +02:00
Aleksander Morgado
b6d628b3a1 build: merge libmm-common into libmm-glib
It's pointless to have libmm-common around, just merge it into libmm-glib and
make ModemManager depend on libmm-glib directly. At the end, the non-common
stuff in libmm-glib is really minimal.
2012-10-04 10:17:05 +02:00