Commit Graph

60 Commits

Author SHA1 Message Date
Ben Chan
0d6e2dc9f5 altair-lte: use mm_autoptr instead of g_autoptr
commit 397faef3c5 ("mm-common-helpers: add mm_autoptr helpers for
GRegex and GMatchInfo") introduces mm_autoptr(), which implements
g_autoptr() that isn't available before glib 2.44. This patch fixes the
code to consistently uses mm_autoptr().
2018-12-13 10:48:21 +01: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
Ben Chan
bf1b396596 tests: use memcmp() instead of g_assert_cmpmem() for now
g_assert_cmpmem() isn't available until glib 2.46, while the minimum
glib version required by ModemManager is 2.36. This patch replaces the
uses of g_assert_cmpmem() with memcmp() instead.
2018-11-08 17:00:59 +01:00
Ben Chan
408a2a9c6c altair-lte: migrate from SubscriptionState to Pco property
In preparation of deprecating the SubscriptionState property in the
Modem3gpp interface, this CL updates the altair-lte plugin to update the
Pco property in the Modem3gpp interface upon receiving %PCOINFO
notification.
2018-10-26 09:41:44 -07:00
Ville Skyttä
90b89bb9f4 *: Spelling fixes 2018-01-25 09:52:12 +01:00
Aleksander Morgado
d1436ac0c6 altair: port 3gpp_register_in_network to GTask
And also use mm_base_modem_at_command() instead of the full() version,
as we're anyway mm_base_modem_peek_best_at_port().

This commit also fixes the logic where we make sure the finish()
method completes the GTask that is created in the async method
originally.
2017-10-06 09:44:41 +02:00
Ben Chan
fbf397cd6f altair-lte: don't use send-delay=0
On the modem with firmware revision ALT3100_04_05_06_10_A8_TF
(LTEUSB_02_04_05_10_53), it's observed that port probing doesn't
complete successfully when send-delay=0 is used.
2017-08-04 15:18:35 +02:00
Ben Chan
03d9619759 altair-lte: port modem_3gpp_load_subscription_state, altair_pco_info_changed to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
de4432da21 altair-lte: port modem_3gpp_disable_unsolicited_events to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
e2b161c684 altair-lte: port modem_3gpp_enable_unsolicited_events to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
00aaa1864a altair-lte: port modem_3gpp_{setup,cleanup}_unsolicited_events to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
282ed056a6 altair-lte: port load_current_bands to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
2d82c505e4 altair-lte: port load_supported_bands to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
4ea38c26e0 altair-lte: port load_unlock_retries to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
e2e7121e44 altair-lte: port load_current_capabilities to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
a96e8f824b altair-lte: port modem_create_bearer to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
555883d107 altair-lte: port modem_3gpp_run_registration_checks to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
15109a8513 altair-lte: port disconnect_3gpp to use GTask 2017-07-19 17:26:40 +02:00
Ben Chan
710d5c036b altair-lte: port connect_3gpp to use GTask 2017-07-19 17:26:40 +02:00
Aleksander Morgado
0be6e7d2ea altair-lte: fix async completion in 3gpp event handlers setting 2017-07-17 10:20:17 +02:00
Ben Chan
989ade7b8c enums: replace Roman numeral suffixes in MM_MODEM_BAND_EUTRAN_*
3GPP TS 36.101 Table 5.5-1 refers the E-UTRA operating bands as 1, 2, 3,
..., etc.
2017-06-28 18:21:25 +02:00
Aleksander Morgado
2eb55d3224 plugins: use G_N_ELEMENTS when iterating ports array 2017-05-30 17:28:23 +02:00
Aleksander Morgado
fcd4a8c5dc altair,hso,samsung: setup send-delay=0 for probing
The Altair, Option HSO and Samsung plugins all use the send-delay=0
setting once the modem object has been created. For consistency, use
the same setting during port probing.
2017-05-30 17:18:32 +02:00
Aleksander Morgado
fba49d8d00 broadband-modem: normalize also operator code
The operator code (MCCMNC) may also be given encoded in the current
charset (e.g. UCS2).

Based on a patch from Colin Helliwell <colin.helliwell@ln-systems.com>
2017-04-02 10:06:13 +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
Ben Chan
31655bb5a5 glib: remove invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute
'deprecated') since glib 2.36 as the type system is automatically
initialized. Since the minimum version of glib required by ModemManager
is 2.36, calling g_type_init() isn't necessarily in the ModemManager
code.
2017-02-03 10:05:14 +01: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
467b3c57f0 modem-helpers: new COPS? response parser
Split into two different actions the actual COPS? response parsing and the
operator name normalization process.

Also, allow parsing not only the operator string, but also the format, mode
and the optional access technology value.
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
Roshan Pius
470b02e8c8 port-probe: Increase AT probe command timeout to 7 seconds for altair.
This patch increases the response timeout for the probe AT commands for
altair modems.

We've been noticing some altair modems taking upto 6 seconds to respond to the
initial probe command after a reset which results in modem-manager
timing out and sending a second probe command. The modem sends a response
after about 6 seconds for the initial probe command which modem-manager
treats as response to second probe command and this results in the
modem-manager and modem going out of sync because the modem's second
probe response is treated as response to the next initialization AT command
sent by modem-manager and so on.

Change-Id: Iad8b0786327b153fd95c8ee4516f352325a42cf7
2015-01-09 21:26:01 +01: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
Thieu Le
0b975f2266 altair-lte: update PCO to handle latest VZW deployment
Update PCO handling code such that it conforms to the latest VZW network
behavior. This includes updating the way we mark a SIM as provisioned.
In the old network, only provisioned SIMs can attach to the network.
Now, unprovisioned SIMs can attach and connect to the network.

Change-Id: Ie454f6fb6d8764161f167e93a4235bb93fbde59a
2014-06-09 16:55:12 +02:00
Thieu Le
a038ff172b altair-lte: handle optional quotes around sim refresh
Some firmware version sends quotes around SIMREFRESH, this patch adds support
for those versions.
2014-06-03 10:52:13 +02:00
Thieu Le
cdb334649d altair-lte: fix memory leak in PCO parsing code
This patch fixes memory leaks in PCO parsing code detected by LeakSanitizer.
2014-05-31 18:55:13 +02:00
Ben Chan
c8f62fb4de altair-lte: ignore invalid bands in %BANDCAP / %GETCFG="BAND" responses
Due to a firmware issue, the modem may reply an invalid band value, such
as 0, for the %BANDCAP or %GETCFG="BAND" command. This patch moves
parse_bands_response() to mm-modem-helpers-altair-lte.c, modifies the
function to ignore any invalid band outside the range of E-UTRAN
operating bands, and add unit tests for the function.
2014-05-29 10:06:37 +02:00
Thieu Le
08d8524b17 altair-lte: prevent connect while processing sim refresh
This patch modifies the Altair LTE plugin to fail connect requests while the
modem has detached from the network when processing sim refresh.
2014-05-28 16:01:56 -05: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
19b0a7e28f altair-lte: add 'mm' prefix in the exported helper methods 2014-01-18 14:16:59 +01:00
Thieu Le
87f0f808bf altair-lte: set subscription state using PCO
This patch sets the subscription state using Verizon's PCO values.
2014-01-18 14:08:31 +01:00
Ben Chan
6c1c0d5e2b altair-lte: explicitly use primary port for connection/disconnection sequence
The Altair LTE modem only uses its primary AT port for AT commands.
Instead of referencing any existing secondary port, this patch changes
MMBroadbandBearerAltairLte to explicitly use the primary port during the
connection and disconnection sequence.
2014-01-07 08:53:10 +01:00
Ben Chan
496f298832 altair-lte: remove unnecessary MM_BASE_MODEM() casts 2014-01-03 12:30:02 +01:00
Ben Chan
dac652321b altair-lte: refactor code for handling 'data' in DetailedConnectContext 2014-01-03 12:30:00 +01:00
Thieu Le
c21709b32e altair-lte: add SIMREFRESH support
Register for SIMREFRESH event and reload own numbers and reregister
modem with network when this happens.
2013-11-21 10:48:53 +01:00
Prathmesh Prabhu
3d4c143b40 altair-lte: early fail connect/disconnect attempts when out of coverage
A firmware bug in Altair ALT3100 bricks the modem when
 - The modem is out of coverage (Registration state is unknown (CEREG: 4))
 - A disconnect attempt is made using the AT%DPDNACT command.

This patch prevents this situation by failing the connect/disconnect attempts in
the altair plugin when registration state is unknown, without attempting to
connect/disconnect the modem.
2013-11-08 08:48:58 +01:00
Prathmesh Prabhu
09ea458f78 altair-lte: obtain subscription state of SIM from registration failure code
This patch uses the extended error code after a registration failure to
determine if the SIM in the relevant modem is associated with a non-provisioned
account. It uses the standard AT+CEER command, but the implementation is
restricted to the altair plugin.
2013-10-10 08:29:56 +02:00
Aleksander Morgado
d818d9fe06 bearer: consolidate unsolicited connection status reports
Originally developed by:
  Ben Chan <benchan@chromium.org>

This patch replaces mm_bearer_report_disconnection() with a more generic
mm_bearer_report_connection_status(), which allows reporting any
connection status of a bearer. This further allows getting rid of those
custom report_connection_status functions in plugic specific bearer
subclasses.

Note that while plugin-specific implementations can receive multiple
'MMBearerConnectionStatus' values, the generic implementation is only allowed
to receive DISCONNECTED. Plugins need to make sure that they process all the
other status values, and only report DISCONNECTED to the parent when required.

MBM:
  The MBM bearer implementation of report_connection_status() expects either
  CONNECTED or DISCONNECTED. If any of these is received and there is an ongoing
  connection attempt, the corresponding operation will be completed. If there is
  no connection attempt, we will just handle the DISCONNECTED state, calling the
  parent method to notify that the modem got network-disconnected.

Icera:
  The Icera bearer implementation of report_connection_status() expects either
  CONNECTED, CONNECT FAILED or DISCONNECTED. If any of these is received and
  there is an ongoing connection or disconnection attempt, the corresponding
  operation will be completed. If there is no connection or disconnection
  attempt, we will just handle the CONNECT FAILED and DISCONNECTED states,
  calling the parent method (always with DISCONNECTED) to notify that the modem
  got network-disconnected.

Option/HSO:
  The Option/HSO bearer implementation of report_connection_status() expects
  either CONNECTED, CONNECTION FAILED or DISCONNECTED. If any of these is
  received and there is an ongoing connection or disconnection attempt, the
  corresponding operation will be completed. If there is no connection or
  disconnection attempt, we will just handle the CONNECTION FAILED and
  DISCONNECTED states, calling the parent method (always with DISCONNECTED) to
  notify that the modem got network-disconnected.

Huawei:
  The Huawei bearer implementation of report_connection_status() expects either
  CONNECTED or DISCONNECTED. These messages are not used to process pending
  connection or disconnection attempts; so if they are received while one of
  these is on-going, it will just be ignored. CONNECTED reports are also
  ignored, so we will just handle the DISCONNECTED state, calling the parent
  method to notify that the modem got network-disconnected.

Altair-LTE:
  The Altair-LTE bearers will only report DISCONNECTED on network-disconnected
  cases. There is no custom report_connection_status().

Novatel-LTE:
  The Novatel-LTE bearers will only report DISCONNECTED on network-disconnected
  cases. There is no custom report_connection_status().
2013-09-23 08:29:15 +02:00
Ben Chan
1eee8824fd altair-lte: use mm_base_modem_at_command_full{,_finish} correctly
This patch fixes own_enable_unsolicited_events_ready() to use
mm_base_modem_at_command_full_finish(), instead of
mm_base_modem_at_sequence_full_finish(), as the %STATCM=1 command is
issued via mm_base_modem_at_command_full().
2013-09-17 08:57:32 +02:00