Commit Graph
49 Commits
Author SHA1 Message Date
Aleksander Morgado 74fc5baca2 core: port GRegex/GMatchInfo to use autoptr()
The behavior of GRegex changed in 2.73.2 once it was ported from pcre1
to pcre2. In some cases it was made more strict, which is fine, in
other cases it exposed some change in how it behaves on certain
matches that is not extremely clear whether it's ok or not.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2729
See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/601
See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/621

Either way, one thing that was assumed was that initializing all
GRegex/GMatchInfo variables to NULL and making sure they're NULL
before they're initialized by glib (especially the GMatchInfo) was a
good and safer approach.

So, whenever possible, g_autoptr() is used to cleanup the allocated
GMatchInfo/GRegex variables, and otherwise, g_clear_pointer() is used
to ensure that no free/unref is attempted unless the given variable is
not NULL, and also so that the variable is reseted to NULL after being
disposed.
2022-09-05 17:33:11 +00: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 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 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 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 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 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
Aleksander Morgado 7bd2ba6973 wavecom: implement custom supported mode loading 2012-05-06 15:34:13 +02:00
Aleksander Morgado c3cc8f8410 wavecom: implement custom power up sequence 2012-05-06 15:34:13 +02:00
Aleksander Morgado 8ce1e26e1b wavecom: implement custom flow control handling 2012-05-06 15:34:13 +02:00
Aleksander Morgado 65b92dfba5 wavecom: implement custom power down sequence 2012-05-06 15:34:12 +02:00
Aleksander Morgado b7d423288a wavecom: start porting the Wavecom plugin 2012-05-06 15:34:12 +02:00