Commit Graph

139 Commits

Author SHA1 Message Date
Aleksander Morgado
4b058872a0 plugins: don't add plugin name in log message explicitly 2020-04-08 17:53:42 +02:00
Aleksander Morgado
8722215f7e plugins: use logging module name as plugin name 2020-04-08 17:53:42 +02:00
Aleksander Morgado
4e0a9b1985 novatel: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
0f708daf0b modem-helpers: port supported modes filtering to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
accd1a5841 base-modem: define new helper MMBaseModemAtCommandAlloc
It has the same exact format as MMBaseModemAtCommand, but its contents
are assumed heap allocated.

The only real purpose of this type is to allow defining static
constant MMBaseModemAtCommand variables without warnings when using
-Wdiscarded-qualifiers.
2020-01-31 15:18:35 +01:00
Aleksander Morgado
f661179310 novatel-lte: fix warnings with -Wdiscarded-qualifiers
novatel/mm-broadband-modem-novatel-lte.c:249:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    249 |     { "+CNUM",  3, TRUE, response_processor_cnum_ignore_at_errors },
        |       ^~~~~~~
  novatel/mm-broadband-modem-novatel-lte.c:250:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    250 |     { "$NWMDN", 3, TRUE, response_processor_nwmdn_ignore_at_errors },
        |       ^~~~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
f560cae145 novatel: fix warnings with -Wswitch-default
novatel/mm-broadband-modem-novatel.c: In function ‘cdma_activation_step’:
  novatel/mm-broadband-modem-novatel.c:1045:5: error: switch missing default case [-Werror=switch-default]
   1045 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-31 14:52:50 +01:00
Aleksander Morgado
a23040756b novatel-lte: fallback to parent scan method
There is no need to run +COPS=? in the same way as the parent does it,
just fallback to the parent implementation.
2020-01-06 20:17:08 +00:00
Aleksander Morgado
8fa622ddbb novatel: implement manual CDMA activation
Including IOTA-based update, e.g. for Sprint.
2019-12-03 08:43:39 +00:00
Aleksander Morgado
5712c71593 novatel: implement automatic CDMA activation 2019-12-03 08:43:39 +00:00
Aleksander Morgado
b765e88e57 novatel: setup as loadable 'shared' utils 2019-11-27 10:11:43 +00: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
Lubomir Rintel
b39dd2ec05 all: drop unused variables
Keeps build with GCC 8 happy.

mm-base-call.c:758:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-base-call.c:822:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-base-sms.c:908:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-sms-list.c:331:25: warning: variable 'ctx' set but not used [-Wunused-but-set-variable]
mm-iface-modem-messaging.c:1210:21: warning: variable 'storage_ctx' set but not used [-Wunused-but-set-variable]
huawei/mm-plugin-huawei.c:183:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
ublox/mm-plugin-ublox.c:161:24: warning: variable 'response' set but not used [-Wunused-but-set-variable]
ublox/mm-plugin-ublox.c:159:24: warning: variable 'ctx' set but not used [-Wunused-but-set-variable]
icera/mm-modem-helpers-icera.c:218:25: warning: variable 'first_free' set but not used [-Wunused-but-set-variable]
novatel/mm-common-novatel.c:50:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
2018-04-24 18:11:15 +02:00
Ben Chan
965ff93041 novatel: port load_supported_modes to use GTask 2017-10-22 08:13:42 +02:00
Ben Chan
fd2bfb7e85 novatel-lte: implement load_unlock_retries
This patch implements load_unlock_retries() for the Novatel LTE modem by
using the AT$NWPINR? command to query the number of retries left for
entering PIN1 or PIN2.

Ported from the original patch by Arman Uguray <armansito@chromium.org>:
https://chromium-review.googlesource.com/c/58118
2017-10-06 10:05:28 +02:00
Ben Chan
0d2a167238 novatel-lte: port disconnect_3gpp to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
71bc8c7506 novatel-lte: port connect_3gpp to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
c13746dad7 novatel-lte: port scan_networks to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
43c4a49bc7 novatel-lte: port load_access_technologies to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
d8be23b606 novatel-lte: port load_current_bands to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
eb59cf8617 novatel-lte: port load_supported_bands to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
b56ea69589 novatel-lte: port modem_after_sim_unlock to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
ced9264a1c novatel-lte: port modem_create_bearer to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
979730247e novatel: port set_current_modes to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
7000039c8c novatel: port load_signal_quality to use GTask 2017-09-13 16:36:49 +02:00
Ben Chan
b14a3be4f1 novatel: port load_current_modes to use GTask 2017-09-13 16:36:49 +02:00
Aleksander Morgado
f54779732a novatel-lte: update frequency bands support
Several changes here:
  * Updated to use the non-deprecated MMModemBand values.
  * Added support for GSM 450, GSM 480 and GSM 750.
2017-09-07 10:55:17 +02:00
Ben Chan
6132a4d2ae novatel: avoid calling qcdm_result_unref on NULL QcdmResult 2017-08-03 12:19:37 +02:00
Aleksander Morgado
4db3ccf2af helpers: +CNUM parser doesn't return any error 2017-07-19 11:21:27 +02:00
Ben Chan
d308bbf4c6 novatel-lte: check error returned by g_task_propagate_error instead
When returning an enum value via g_task_return_int, some code assumes
the enum value is always non-negative and thus considers that a negative
value implies an error. This assumption could be invalidated if a
negative value is later added to the enum. To make it less error prone
to future changes, this patch modifies the code to check if the GError
argument to g_task_propagate_error is populated instead.
2017-07-07 10:16:09 +02:00
Aleksander Morgado
4fe464f5f7 core: prefer g_task_return_error_if_cancelled() than custom errors
When the GCancellable is added to the GTask, we can use a single
method call to check for the task being cancelled, and complete it
right away if so.

This patch also clears up the logic in the Novatel plugin, where the
code was trying to return "TRUE" when the task was cancelled, but
wouldn't work as the check-cancellable flag in the GTask is TRUE by
default (i.e. when completing the GTask, if it was cancelled, a
G_IO_ERROR_CANCELLED would be returned by default, regardless of any
other return value set).

This patch also introduces a small variation of the logic in the
Cinterion plugin: instead of running SWWAN=0 before completing the
async action, the command is now sent just after completion of the
async action. This shouldn't be an issue, as the SWWAN result itself
is ignored.
2017-04-18 19:31:02 +02:00
Dan Williams
977d5ac6ce broadband-modem-novatel: $NWRSSI can report lower values than -115
My E725 reported 125 once; that's a valid dBm and MM shouldn't report
an error when parsing it.
2017-04-17 11:59:12 -05:00
Dan Williams
dedc1f15c7 broadband-modem-novatel: clean up detailed registration state handling
Allocate the results instead of passing them back on the stack, which removes
the "can't complete in idle" restriction.  Also always open the QCDM port
since we can't assume it will be open already at this point.
2017-04-17 11:59:12 -05:00
Dan Williams
77fbcf534b broadband-modem-novatel: clean up access technology reporting
Instead of mixing the QCDM Novatel Snapshot code directly into the
access technology checking code, split it out with its own async
result.  At the same time, make sure to open the QCDM port when
it's needed, instead of assuming its already open.  Since it won't
always be.
2017-04-17 11:59:12 -05:00
Ben Chan
031c753a00 novatel: obtain MMPortProbe from GTask source object
The MMPortProbe object is already referenced by the GTask object for
custom init. Instead of keeping another reference of MMPortProbe in the
CustomInitContext, this patch changes the code to simply obtain it from
the source object of GTask.

See https://lists.freedesktop.org/archives/modemmanager-devel/2017-April/004420.html
2017-04-07 10:31:10 -05:00
Ben Chan
6542430588 novatel: port IMSI loading to use GTask 2017-04-06 20:31:39 +02:00
Ben Chan
1e05fd4df6 novatel: port custom init to use GTask 2017-04-06 20:30:08 +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
2c5af4f0bc core: use a default timeout of 300s for the scan networks operation
This is the value which we actually suggest in the manpage for the mmcli
operation, so just use the same one.

   Scanning for 3GPP networks may really take a long time, so a specific timeout must be given:
       $ mmcli -m 0 --3gpp-scan --timeout=300

       Found 4 networks:
       21404 - Yoigo (umts, available)
       21407 - Movistar (umts, current)
       21401 - vodafone ES (umts, forbidden)
       21403 - Orange (umts, forbidden)

https://bugs.freedesktop.org/show_bug.cgi?id=98235
2016-10-24 13:34:27 +02:00
Aleksander Morgado
f2c2a6a05f novatel: subclass the connection monitoring logic
Instead of setting up a custom timeout source to poll the connection status, use
the generic logic in the base bearer object, and just re-implement the command
used to check the status.
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
ffde429843 core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncs 2015-12-02 17:07:39 +01:00
Aleksander Morgado
46b2aeae53 novatel: fix checking for time support 2015-03-11 19:39:24 +01:00
Aleksander Morgado
93d6e4f102 dell: new Dell plugin
For Dell-branded Novatel, Sierra and Ericsson modems.

The Novatel plugin will no longer accept every Dell-branded modem, which was
the current situation. Instead, a new Dell plugin will take care of probing for
the correct vendor string, and based on the results create a specific Novatel,
Sierra or Ericsson modem.

In order to properly support this, the Novatel, Sierra and MBM plugins now
export their implementations into non-inst libraries that the Dell plugin will
import.

Also, for now, the Dell plugin doesn't make any difference between e.g. Sierra
or Ericsson MBIM implementations, just a generic MBIM modem is created in both
cases, as that is anyway what the Ericsson MBM and Sierra plugins do already.

https://bugs.freedesktop.org/show_bug.cgi?id=86713
2015-02-16 17:33:37 +01:00
Aleksander Morgado
7c929b5cf1 novatel: move custom init method to separate source files 2015-02-16 17:30:38 +01:00
Aleksander Morgado
6fb83b5e02 novatel: remove unused custom AT probe array 2015-02-06 15:38:11 +01:00
Ben Chan
4669611412 broadband-modem,plugins: fix GMatchInfo leaks 2014-08-12 09:45:50 +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